static int _m_CopyToAsync(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                MongoDB.Bson.IO.BsonStreamAdapter gen_to_be_invoked = (MongoDB.Bson.IO.BsonStreamAdapter)translator.FastGetCSObj(L, 1);



                {
                    System.IO.Stream _destination = (System.IO.Stream)translator.GetObject(L, 2, typeof(System.IO.Stream));
                    int _bufferSize = LuaAPI.xlua_tointeger(L, 3);
                    System.Threading.CancellationToken _cancellationToken; translator.Get(L, 4, out _cancellationToken);

                    System.Threading.Tasks.Task gen_ret = gen_to_be_invoked.CopyToAsync(_destination, _bufferSize, _cancellationToken);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }