Example #1
0
 public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packSize, int typeSize)
 {
     throw null;
 }
 public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packSize, int typeSize)
 {
     throw new PlatformNotSupportedException();
 }
Example #3
0
 public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packSize, int typeSize)
 {
     return(default(System.Reflection.Emit.TypeBuilder));
 }
        private void Init(string fullname, TypeAttributes attr, Type parent, Type[] interfaces, System.Reflection.Module module, System.Reflection.Emit.PackingSize iPackingSize, int iTypeSize, TypeBuilder enclosingType)
        {
            if (fullname == null)
            {
                throw new ArgumentNullException("fullname");
            }
            if (fullname.Length == 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fullname");
            }
            if (fullname[0] == '\0')
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fullname");
            }
            if (fullname.Length > 0x3ff)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_TypeNameTooLong"), "fullname");
            }
            this.m_bIsGenTypeDef = false;
            this.m_bIsGenParam = false;
            this.m_hasBeenCreated = false;
            this.m_runtimeType = null;
            this.m_isHiddenGlobalType = false;
            this.m_isHiddenType = false;
            this.m_module = (ModuleBuilder) module;
            this.m_DeclaringType = enclosingType;
            AssemblyBuilder containingAssemblyBuilder = this.m_module.ContainingAssemblyBuilder;
            this.m_underlyingSystemType = null;
            containingAssemblyBuilder.m_assemblyData.CheckTypeNameConflict(fullname, enclosingType);
            if ((enclosingType != null) && (((attr & TypeAttributes.NestedFamORAssem) == TypeAttributes.Public) || ((attr & TypeAttributes.NestedFamORAssem) == TypeAttributes.AnsiClass)))
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_BadNestedTypeFlags"), "attr");
            }
            int[] interfaceTokens = null;
            if (interfaces != null)
            {
                int num;
                for (num = 0; num < interfaces.Length; num++)
                {
                    if (interfaces[num] == null)
                    {
                        throw new ArgumentNullException("interfaces");
                    }
                }
                interfaceTokens = new int[interfaces.Length + 1];
                for (num = 0; num < interfaces.Length; num++)
                {
                    interfaceTokens[num] = this.m_module.GetTypeTokenInternal(interfaces[num]).Token;
                }
            }
            int length = fullname.LastIndexOf('.');
            switch (length)
            {
                case -1:
                case 0:
                    this.m_strNameSpace = string.Empty;
                    this.m_strName = fullname;
                    break;

                default:
                    this.m_strNameSpace = fullname.Substring(0, length);
                    this.m_strName = fullname.Substring(length + 1);
                    break;
            }
            this.VerifyTypeAttributes(attr);
            this.m_iAttr = attr;
            this.SetParent(parent);
            this.m_listMethods = new List<MethodBuilder>();
            this.m_lastTokenizedMethod = -1;
            this.SetInterfaces(interfaces);
            this.m_constructorCount = 0;
            int tkParent = 0;
            if (this.m_typeParent != null)
            {
                tkParent = this.m_module.GetTypeTokenInternal(this.m_typeParent).Token;
            }
            int tkEnclosingType = 0;
            if (enclosingType != null)
            {
                tkEnclosingType = enclosingType.m_tdType.Token;
            }
            this.m_tdType = new System.Reflection.Emit.TypeToken(DefineType(this.m_module.GetNativeHandle(), fullname, tkParent, this.m_iAttr, tkEnclosingType, interfaceTokens));
            this.m_iPackingSize = iPackingSize;
            this.m_iTypeSize = iTypeSize;
            if ((this.m_iPackingSize != System.Reflection.Emit.PackingSize.Unspecified) || (this.m_iTypeSize != 0))
            {
                SetClassLayout(this.GetModuleBuilder().GetNativeHandle(), this.m_tdType.Token, this.m_iPackingSize, this.m_iTypeSize);
            }
            if (IsPublicComType(this))
            {
                if (containingAssemblyBuilder.IsPersistable() && !this.m_module.IsTransient())
                {
                    containingAssemblyBuilder.m_assemblyData.AddPublicComType(this);
                }
                if (!this.m_module.Equals(containingAssemblyBuilder.ManifestModule))
                {
                    containingAssemblyBuilder.DefineExportedTypeInMemory(this, this.m_module.m_moduleData.FileToken, this.m_tdType.Token);
                }
            }
        }