当前位置: 首页>>代码示例>>C#>>正文


C# TypeBuilder.SetParent方法代码示例

本文整理汇总了C#中System.Reflection.Emit.TypeBuilder.SetParent方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.SetParent方法的具体用法?C# TypeBuilder.SetParent怎么用?C# TypeBuilder.SetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Emit.TypeBuilder的用法示例。


在下文中一共展示了TypeBuilder.SetParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DefineType

        private void DefineType()
        {
            const string dispatcherName = IntegrationAssemblyBuilder.IntegrationAssemblyName + ".ExecutorDispatcher";

            _dispatcherBuilder = _modBuilder.DefineType(dispatcherName, TypeAttributes.Class | TypeAttributes.Public);
            _dispatcherBuilder.SetParent(typeof(RuleBasedDispatcher));
        }
开发者ID:Codestellation,项目名称:Emisstar,代码行数:7,代码来源:DispatcherBuilder.cs

示例2: EmitBaseTypesAndAttributes

        void EmitBaseTypesAndAttributes(TypeDefinition typeDefinition, TypeBuilder typeBuilder)
        {
            foreach (TypeReference baseType in typeDefinition.BaseTypes)
            {
                Type type = GetSystemType(baseType);

                // For some reason you can't call IsClass on constructed types created at compile time,
                // so we'll ask the generic definition instead
                if ((type.IsGenericType && type.GetGenericTypeDefinition().IsClass) || (type.IsClass))
                {
                    typeBuilder.SetParent(type);
                }
                else
                {
                    typeBuilder.AddInterfaceImplementation(type);
                }
            }
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:18,代码来源:EmitAssembly.cs

示例3: Generate

 void Generate(ref TypeBuilder tBuilder, Class c)
 {
     // parent and interfaces
     foreach (Class baseType in c.BaseTypes) {
         Type t = GetType(baseType);
         if (t == null) {
             // parent, or interface is not
             // public namespace, or inner
             Console.WriteLine("WARNING: skipped base type {0} for {1}",
                 baseType, tBuilder.FullName);
             continue;
         }
         if (baseType.IsInterface) {
             tBuilder.AddInterfaceImplementation(t);
         } else {
             tBuilder.SetParent(t);
         }
     }
 }
开发者ID:olympum,项目名称:caffeine,代码行数:19,代码来源:TypeGenerator.cs

示例4: PreBuild

 protected override void PreBuild()
 {
     if(Info != null)
     {
         return;
     }
     var cont = CurrentContainer;
     Builder = cont.CreateType(Name, Attributes);
     Info = Builder;
     if (Generics.Count > 0)
     {
         var gb = Builder.DefineGenericParameters(Generics.ToNames());
         Generics.RegisterBuilders(gb);
     }
     if (BaseType != null)
     {
         Builder.SetParent(BaseType.GainType()); //todo ジェネリクスに対応したTypeを生成する。
     }
     Builder.AddImplements(Implements);
 }
开发者ID:B-head,项目名称:Dreit-prototype,代码行数:20,代码来源:PureTypeStructure.cs

示例5: Visit

 private void Visit(ITypeDefinition typeDefinition, TypeBuilder typeBuilder) {
   if (typeDefinition.HasDeclarativeSecurity) {
     foreach (var securityAttribute in typeDefinition.SecurityAttributes)
       typeBuilder.AddDeclarativeSecurity(GetSecurityAction(securityAttribute), GetPermissionSet(securityAttribute));
   }
   foreach (var implementedInterface in typeDefinition.Interfaces)
     typeBuilder.AddInterfaceImplementation(this.loader.mapper.GetType(implementedInterface));
   foreach (var explicitOverride in typeDefinition.ExplicitImplementationOverrides) {
     typeBuilder.DefineMethodOverride((MethodInfo)this.loader.mapper.GetMethod(explicitOverride.ImplementingMethod),
       (MethodInfo)this.loader.mapper.GetMethod(explicitOverride.ImplementedMethod));
   }
   if (typeDefinition.IsGeneric) {
     foreach (var genericParameter in typeDefinition.GenericParameters)
       this.Visit(genericParameter);
   }
   foreach (var customAttribute in typeDefinition.Attributes) {
     var customAttributeBuilder = this.GetCustomAttributeBuilder(customAttribute);
     typeBuilder.SetCustomAttribute(customAttributeBuilder);
   }
   foreach (var baseType in typeDefinition.BaseClasses) {
     typeBuilder.SetParent(this.loader.mapper.GetType(baseType));
     break;
   }
 }
开发者ID:modulexcite,项目名称:Microsoft.Cci.Metadata,代码行数:24,代码来源:Emitter.cs

示例6: InitTypeBuilder

		internal void InitTypeBuilder (ModuleBuilder moduleBuilder, string next_type)
		{ 
			type_builder = moduleBuilder.DefineType (next_type, TypeAttributes.Public);
			type_builder.SetParent (typeof (GlobalScope));
			type_builder.SetCustomAttribute (new CustomAttributeBuilder
							 (typeof (CompilerGlobalScopeAttribute).GetConstructor (new Type [] {}), new object [] {}));
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:ScriptBlock.cs


注:本文中的System.Reflection.Emit.TypeBuilder.SetParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。