internal ILEnumBuilder(ILAssemblyBuilder asmBuilder, string name, TypeAttributes attributes) { this._ilAsmBuilder = asmBuilder; this.EnumBuilder = asmBuilder.ModuleBuilder.DefineEnum(name, attributes, typeof(int)); this.Name = name; }
internal ILTypeBuilder(ILAssemblyBuilder builder, string typeName, TypeAttributes attributes, Type baseType, Type[] interfaces) { Type runtime = typeof(Type).GetType(); if (baseType.GetType() != runtime) { throw new ArgumentException("Temel sınıf tür tanımlayıcısı, System.RuntimeType tipinde olmalı."); } if (baseType.IsInterface) { throw new BuildException("Arabirimler temel sınıf olarak kullanılamaz."); } if (baseType.IsAbstract && baseType.IsSealed) { throw new BuildException("Static sınıflar temel sınıf olarak kullanılamaz."); } if (baseType.IsSealed) { throw new BuildException("Mühürlenmiş sınıflar temel sınıf olarak kullanılamaz."); } this.ILAssemblyBuilder = builder; if (baseType == null) { this.TypeBuilder = builder.ModuleBuilder.DefineType(typeName, attributes); } else { this.TypeBuilder = builder.ModuleBuilder.DefineType(typeName, attributes, baseType); } if (interfaces != null && interfaces.Length > 0) { for (int i = 0; i < interfaces.Length; i++) { Type interfaceType = interfaces[i]; if (interfaceType.IsInterface) { if (interfaceType.GetType() == runtime) { this.TypeBuilder.AddInterfaceImplementation(interfaceType); } else { throw new BuildException("Yerleştirilen arabirim tanımlayıcılarının hepsi System.RuntimeType türünden olmalıdır."); } } else { throw new BuildException("Yerleştirilen arabirimlerden birisi bir arabirim değildi. Geçersiz arabirim ismi " + interfaceType.Name); } } } this._fields = new Dictionary <string, FieldBuilder>(); if (interfaces == null) { this._interfaces = new Type[0]; } else { this._interfaces = interfaces; } this._genArgs = new Dictionary <string, GenericTypeParameterBuilder>(); this._properties = new Dictionary <string, ILPropertyBuilder>(); this._definedMethods = new Dictionary <string, List <ILMethodBuilder> >(); this._ctors = new List <ILConstructorBuilder>(); this.Name = typeName; this._setBaseType = !(baseType == null || baseType == typeof(object)); }