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


C# Emitters.AbstractTypeEmitter类代码示例

本文整理汇总了C#中Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter的典型用法代码示例。如果您正苦于以下问题:C# AbstractTypeEmitter类的具体用法?C# AbstractTypeEmitter怎么用?C# AbstractTypeEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractTypeEmitter类属于Castle.DynamicProxy.Generators.Emitters命名空间,在下文中一共展示了AbstractTypeEmitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTypeBuilder

		private static TypeBuilder CreateTypeBuilder(AbstractTypeEmitter maintype, string name, TypeAttributes attributes, Type baseType, Type[] interfaces)
		{
			return maintype.TypeBuilder.DefineNestedType(
				name,
				attributes,
				baseType, interfaces);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:7,代码来源:NestedClassEmitter.cs

示例2: EventEmitter

		public EventEmitter(AbstractTypeEmitter typeEmitter, string name, EventAttributes attributes, Type type)
		{
			this.typeEmitter = typeEmitter;
			this.type = type;
			this.name = name;
			eventBuilder = typeEmitter.TypeBuilder.DefineEvent(name, attributes, type);
		}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:EventEmitter.cs

示例3: NestedClassEmitter

		public NestedClassEmitter(AbstractTypeEmitter maintype, String name, Type baseType, Type[] interfaces)
			: this(
				maintype,
				CreateTypeBuilder(maintype, name, TypeAttributes.Sealed | TypeAttributes.NestedPublic | TypeAttributes.Class,
				                  baseType, interfaces))
		{
		}
开发者ID:leloulight,项目名称:Core,代码行数:7,代码来源:NestedClassEmitter.cs

示例4: CreateTypeBuilder

		private static TypeBuilder CreateTypeBuilder(AbstractTypeEmitter maintype, string name, Type baseType, Type[] interfaces)
		{
			return maintype.TypeBuilder.DefineNestedType(
				name,
				TypeAttributes.Sealed | TypeAttributes.NestedPublic | TypeAttributes.Class,
				baseType, interfaces);
		}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:NestedClassEmitter.cs

示例5: ImplementInvokeMethodOnTarget

		protected override void ImplementInvokeMethodOnTarget(AbstractTypeEmitter invocation, ParameterInfo[] parameters, MethodEmitter invokeMethodOnTarget, Reference targetField)
		{
			invokeMethodOnTarget.CodeBuilder.AddStatement(
				new ExpressionStatement(
					new MethodInvocationExpression(SelfReference.Self, InvocationMethods.EnsureValidTarget)));
			base.ImplementInvokeMethodOnTarget(invocation, parameters, invokeMethodOnTarget, targetField);
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:7,代码来源:CompositionInvocationTypeGenerator.cs

示例6: GetClosedParameterType

		public static Type GetClosedParameterType(AbstractTypeEmitter type, Type parameter)
		{
			if (parameter.IsGenericTypeDefinition)
			{
				return parameter.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArgumentsFor(parameter));
			}

			if (parameter.IsGenericType)
			{
				Type[] arguments = parameter.GetGenericArguments();
				if (CloseGenericParametersIfAny(type, arguments))
				{
					return parameter.GetGenericTypeDefinition().MakeGenericType(arguments);
				}
			}
			
			if (parameter.IsGenericParameter)
			{
				return type.GetGenericArgument(parameter.Name);
			}

			if (parameter.IsArray)
			{
				var elementType = GetClosedParameterType(type, parameter.GetElementType());
				return elementType.MakeArrayType();
			}
			
			if(parameter.IsByRef)
			{
				var elementType = GetClosedParameterType(type, parameter.GetElementType());
				return elementType.MakeByRefType();
			}

			return parameter;
		}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:35,代码来源:TypeUtil.cs

示例7: GetCallbackMethodInvocation

		public MethodInvocationExpression GetCallbackMethodInvocation(AbstractTypeEmitter invocation, Expression[] args,
		                                                              Reference targetField,
		                                                              MethodEmitter invokeMethodOnTarget)
		{
			var @delegate = GetDelegate(invocation, invokeMethodOnTarget);
			return new MethodInvocationExpression(@delegate, GetCallbackMethod(), args);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:7,代码来源:InvocationWithGenericDelegateContributor.cs

示例8: GetCallbackMethodInvocation

		public MethodInvocationExpression GetCallbackMethodInvocation(AbstractTypeEmitter invocation, Expression[] args, Reference targetField, MethodEmitter invokeMethodOnTarget)
		{
			var allArgs = GetAllArgs(args, targetField);
			var @delegate = (Reference)invocation.GetField("delegate");

			return new MethodInvocationExpression(@delegate, GetCallbackMethod(), allArgs);
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:7,代码来源:InvocationWithDelegateContributor.cs

示例9: PropertyEmitter

        // private ParameterInfo[] indexParameters;

        public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
                               Type propertyType, Type[] arguments)
        {
            this.parentTypeEmitter = parentTypeEmitter;

            // DYNPROXY-73 - AmbiguousMatchException for properties
            // This is a workaround for a framework limitation in CLR 2.0 
            // This limitation was removed in CLR 2.0 SP1, but we don't want to 
            // tie ourselves to that version. This perform the lookup for the new overload
            // dynamically, so we have a nice fallback on vanilla CLR 2.0

            if (TypeBuilderMethods.DefineProperty == null)
            {
                DefineProperty_Clr2_0 oldDefineProperty = parentTypeEmitter.TypeBuilder.DefineProperty;
                builder = oldDefineProperty(name, attributes, propertyType, arguments);
            }
            else
            {
                var newDefinedProperty = (DefineProperty_Clr_2_0_SP1)
                                         Delegate.CreateDelegate(typeof(DefineProperty_Clr_2_0_SP1),
                                                                 parentTypeEmitter.TypeBuilder,
                                                                 TypeBuilderMethods.DefineProperty);
                builder = newDefinedProperty(
                    name, attributes, CallingConventions.HasThis, propertyType,
                    null, null, arguments, null, null);
            }
        }
开发者ID:brianmatic,项目名称:n2cms,代码行数:29,代码来源:PropertyEmitter.cs

示例10: PropertyEmitter

        // private ParameterInfo[] indexParameters;
        public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, String name, PropertyAttributes attributes,
		                       Type propertyType)
        {
            this.parentTypeEmitter = parentTypeEmitter;

            builder = parentTypeEmitter.TypeBuilder.DefineProperty(name, attributes, propertyType, new Type[0]);
        }
开发者ID:havard,项目名称:strongbind,代码行数:8,代码来源:PropertyEmitter.cs

示例11: ConstructorEmitter

		internal ConstructorEmitter(AbstractTypeEmitter maintype, params ArgumentReference[] arguments)
		{
			this.maintype = maintype;

			var args = ArgumentsUtil.InitializeAndConvert(arguments);

			builder = maintype.TypeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, args);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:8,代码来源:ConstructorEmitter.cs

示例12: EventEmitter

		public EventEmitter(AbstractTypeEmitter typeEmitter, string name, EventAttributes attributes, Type type)
		{
			if (name == null) throw new ArgumentNullException("name");
			if (type == null) throw new ArgumentNullException("type");
			this.typeEmitter = typeEmitter;
			this.type = type;
			eventBuilder = typeEmitter.TypeBuilder.DefineEvent(name, attributes, type);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:8,代码来源:EventEmitter.cs

示例13: MethodEmitter

		internal MethodEmitter(AbstractTypeEmitter owner, String name,
		                       MethodAttributes attributes, Type returnType,
		                       params Type[] argumentTypes)
			: this(owner, name, attributes)
		{
			SetParameters(argumentTypes);
			SetReturnType(returnType);
		}
开发者ID:ArturDorochowicz,项目名称:Core,代码行数:8,代码来源:MethodEmitter.cs

示例14: CreateConstructor

		public ConstructorEmitter CreateConstructor(ArgumentReference[] baseCtorArguments, AbstractTypeEmitter invocation)
		{
			var arguments = GetArguments(baseCtorArguments);
			var constructor = invocation.CreateConstructor(arguments);

			var delegateField = invocation.CreateField("delegate", delegateType);
			constructor.CodeBuilder.AddStatement(new AssignStatement(delegateField, new ReferenceExpression(arguments[0])));
			return constructor;
		}
开发者ID:vbedegi,项目名称:Castle.Core,代码行数:9,代码来源:InvocationWithDelegateContributor.cs

示例15: PropertyEmitter

		public PropertyEmitter(AbstractTypeEmitter parentTypeEmitter, string name, PropertyAttributes attributes,
		                       Type propertyType, Type[] arguments)
		{
			this.parentTypeEmitter = parentTypeEmitter;

			builder = parentTypeEmitter.TypeBuilder.DefineProperty(
				name, attributes, CallingConventions.HasThis, propertyType,
				null, null, arguments, null, null);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:9,代码来源:PropertyEmitter.cs


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