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


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



                {
                    int    _position = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _source   = LuaAPI.lua_tobytes(L, 3);
                    int    _offset   = LuaAPI.xlua_tointeger(L, 4);
                    int    _count    = LuaAPI.xlua_tointeger(L, 5);

                    gen_to_be_invoked.SetBytes(_position, _source, _offset, _count);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_GetSlice(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    int _position = LuaAPI.xlua_tointeger(L, 2);
                    int _length   = LuaAPI.xlua_tointeger(L, 3);

                    MongoDB.Bson.IO.IByteBuffer gen_ret = gen_to_be_invoked.GetSlice(_position, _length);
                    translator.PushAny(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _s_set_Length(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                MongoDB.Bson.IO.ByteBufferSlice gen_to_be_invoked = (MongoDB.Bson.IO.ByteBufferSlice)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.Length = LuaAPI.xlua_tointeger(L, 2);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(0);
        }
        static int _g_get_IsReadOnly(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                MongoDB.Bson.IO.ByteBufferSlice gen_to_be_invoked = (MongoDB.Bson.IO.ByteBufferSlice)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushboolean(L, gen_to_be_invoked.IsReadOnly);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 4 && translator.Assignable <MongoDB.Bson.IO.IByteBuffer>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
                {
                    MongoDB.Bson.IO.IByteBuffer _buffer = (MongoDB.Bson.IO.IByteBuffer)translator.GetObject(L, 2, typeof(MongoDB.Bson.IO.IByteBuffer));
                    int _offset = LuaAPI.xlua_tointeger(L, 3);
                    int _length = LuaAPI.xlua_tointeger(L, 4);

                    MongoDB.Bson.IO.ByteBufferSlice gen_ret = new MongoDB.Bson.IO.ByteBufferSlice(_buffer, _offset, _length);
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to MongoDB.Bson.IO.ByteBufferSlice constructor!"));
        }
        static int _m_MakeReadOnly(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    gen_to_be_invoked.MakeReadOnly(  );



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_EnsureCapacity(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    int _minimumCapacity = LuaAPI.xlua_tointeger(L, 2);

                    gen_to_be_invoked.EnsureCapacity(_minimumCapacity);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_AccessBackingBytes(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    int _position = LuaAPI.xlua_tointeger(L, 2);

                    System.ArraySegment <byte> gen_ret = gen_to_be_invoked.AccessBackingBytes(_position);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_SetByte(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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



                {
                    int  _position = LuaAPI.xlua_tointeger(L, 2);
                    byte _value    = (byte)LuaAPI.xlua_tointeger(L, 3);

                    gen_to_be_invoked.SetByte(_position, _value);



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