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


C# Reflection.Module类代码示例

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


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

示例1: CustomAttributeData

 internal CustomAttributeData(Module scope, CustomAttributeRecord caRecord)
 {
     this.m_scope = scope;
     this.m_ctor = (ConstructorInfo) RuntimeType.GetMethodBase(scope, (int) caRecord.tkCtor);
     ParameterInfo[] parametersNoCopy = this.m_ctor.GetParametersNoCopy();
     this.m_ctorParams = new CustomAttributeCtorParameter[parametersNoCopy.Length];
     for (int i = 0; i < parametersNoCopy.Length; i++)
     {
         this.m_ctorParams[i] = new CustomAttributeCtorParameter(InitCustomAttributeType(parametersNoCopy[i].ParameterType, scope));
     }
     FieldInfo[] fields = this.m_ctor.DeclaringType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
     PropertyInfo[] properties = this.m_ctor.DeclaringType.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
     this.m_namedParams = new CustomAttributeNamedParameter[properties.Length + fields.Length];
     for (int j = 0; j < fields.Length; j++)
     {
         this.m_namedParams[j] = new CustomAttributeNamedParameter(fields[j].Name, CustomAttributeEncoding.Field, InitCustomAttributeType(fields[j].FieldType, scope));
     }
     for (int k = 0; k < properties.Length; k++)
     {
         this.m_namedParams[k + fields.Length] = new CustomAttributeNamedParameter(properties[k].Name, CustomAttributeEncoding.Property, InitCustomAttributeType(properties[k].PropertyType, scope));
     }
     this.m_members = new MemberInfo[fields.Length + properties.Length];
     fields.CopyTo(this.m_members, 0);
     properties.CopyTo(this.m_members, fields.Length);
     CustomAttributeEncodedArgument.ParseAttributeArguments(caRecord.blob, ref this.m_ctorParams, ref this.m_namedParams, this.m_scope);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:26,代码来源:CustomAttributeData.cs

示例2: CodeGenerator

        public CodeGenerator(Module targetModule)
            : this()
        {
            Check.Require(targetModule != null, "targetModule could not be null.");

            this.serializationModule = targetModule;
        }
开发者ID:Oman,项目名称:Maleos,代码行数:7,代码来源:CodeGenerator.cs

示例3: getMethod

 public MethodBase getMethod(Module module)
 {
     MethodsModule methodsModule;
     if (!moduleToMethods.TryGetValue(module, out methodsModule))
         moduleToMethods[module] = methodsModule = new MethodsModule(module);
     return methodsModule.getNext();
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:MethodsRewriter.cs

示例4: PropertyBuilder

        // Constructs a PropertyBuilder.  
    	//
        internal PropertyBuilder(
    		Module			mod,					// the module containing this PropertyBuilder
    		String			name,					// property name
    		SignatureHelper	sig,					// property signature descriptor info
    		PropertyAttributes	attr,				// property attribute such as DefaultProperty, Bindable, DisplayBind, etc
			Type			returnType,				// return type of the property.
    		PropertyToken	prToken,				// the metadata token for this property
            TypeBuilder     containingType)         // the containing type
        {
            if (name == null)
                throw new ArgumentNullException("name");
			if (name.Length == 0)
				throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
            if (name[0] == '\0')
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name");
    		
            m_name = name;
            m_module = mod;
            m_signature = sig;
            m_attributes = attr;
			m_returnType = returnType;
    		m_prToken = prToken;
            m_tkProperty = prToken.Token;
            m_getMethod = null;
            m_setMethod = null;
            m_containingType = containingType;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:29,代码来源:propertybuilder.cs

示例5: DynamicAssemblyManager

        static DynamicAssemblyManager()
        {
#if !SILVERLIGHT
            assemblyName = new AssemblyName("NLiteDynamicAssembly");
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                assemblyName,
                AssemblyBuilderAccess.RunAndSave
                );

            moduleBuilder = assemblyBuilder.DefineDynamicModule(
                assemblyName.Name,
                assemblyName.Name + ".dll",
                true);

            Module = assemblyBuilder.GetModules().FirstOrDefault();
           
#else
            assemblyName = new AssemblyName("EmitMapperAssembly.SL");
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                  assemblyName,
                  AssemblyBuilderAccess.Run
                  );
            moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, true);
#endif
        }
开发者ID:netcasewqs,项目名称:nlite,代码行数:25,代码来源:DynamicAssemblyManager.cs

示例6: ScriptAssembly

		/// <summary>
		/// Creates an instance of <see cref="ScriptAssembly"/>.
		/// </summary>
		/// <param name="module">The CLR module.</param>
		/// <param name="namespacing">Whether namespacing is applied.</param>
		public ScriptAssembly(Module/*!*/ module, bool namespacing)
		{
			Debug.Assert(module != null);

			this.module = module;
			this.namespacing = namespacing;
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:12,代码来源:ScriptAssembly.cs

示例7: ModuleScopeTokenResolver

 public ModuleScopeTokenResolver(MethodBase method)
 {
     m_enclosingMethod = method;
     m_module = method.Module;
     m_methodContext = (method is ConstructorInfo) ? null : method.GetGenericArguments();
     m_typeContext = (method.DeclaringType == null) ? null : method.DeclaringType.GetGenericArguments();
 }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:ModuleScopeTokenResolver.cs

示例8: ResolveMember

        public static MemberInfo ResolveMember(Module module, int metadataToken)
        {
            Assumes.NotNull(module);
            Assumes.IsTrue(metadataToken != 0);

            return module.ResolveMember(metadataToken);
        }
开发者ID:ibratoev,项目名称:MEF.NET35,代码行数:7,代码来源:ReflectionResolver.cs

示例9: GetLocalVarSigHelper

		public static SignatureHelper GetLocalVarSigHelper (Module mod)
		{
			if (mod != null && !(mod is ModuleBuilder))
				throw new ArgumentException ("ModuleBuilder is expected");

			return new SignatureHelper ((ModuleBuilder) mod, SignatureHelperType.HELPER_LOCAL);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:SignatureHelper.cs

示例10: DoMutate_Returns_Correct_Sequences

        public void DoMutate_Returns_Correct_Sequences()
        {
            var module = new Module(Assembly.GetExecutingAssembly().Location);
            module.LoadDebugInformation();
            var method = module.Definition
                .Types.Single(t => t.Name == "VariableReadClassUnderTest")
                .Methods.Single(t => t.Name == "AddAndDouble");

            var mutatedInstruction = method.Body.Instructions.First(i => i.OpCode == OpCodes.Ldarg_1);
            string hexPrefix = string.Format("{0:x4}: ", mutatedInstruction.Offset);

            var mutator = new VariableReadTurtle();
            IList<MutantMetaData> mutations = mutator
                .Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            // V2 is only read for the return statement; this case is excluded in the code.
            Assert.AreEqual(9, mutations.Count);
            StringAssert.EndsWith(hexPrefix + "read substitution Int32.a => Int32.b", mutations[0].Description);
            StringAssert.EndsWith("read substitution Int32.a => Int32.total", mutations[1].Description);
            StringAssert.EndsWith("read substitution Int32.a => Int32.CS$1$0000", mutations[2].Description);
            StringAssert.EndsWith("read substitution Int32.b => Int32.a", mutations[3].Description);
            StringAssert.EndsWith("read substitution Int32.b => Int32.total", mutations[4].Description);
            StringAssert.EndsWith("read substitution Int32.b => Int32.CS$1$0000", mutations[5].Description);
            StringAssert.EndsWith("read substitution Int32.total => Int32.a", mutations[6].Description);
            StringAssert.EndsWith("read substitution Int32.total => Int32.b", mutations[7].Description);
            StringAssert.EndsWith("read substitution Int32.total => Int32.CS$1$0000", mutations[8].Description);
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:27,代码来源:VariableReadTurtleTests.cs

示例11: EventOperation

 public EventOperation(Delegate assignation)
 {
     _delegateMethod = assignation.Method;
     MethodBody body = _delegateMethod.GetMethodBody();
     _stream = new MemoryStream(body.GetILAsByteArray());
     _module = _delegateMethod.Module;
 }
开发者ID:dgg,项目名称:testing-commons,代码行数:7,代码来源:EventOperation.cs

示例12: GetMethodSigHelper

        internal static SignatureHelper GetMethodSigHelper(
            Module scope, CallingConventions callingConvention, int cGenericParam,
            Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers,
            Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
        {
            SignatureHelper sigHelp;
            MdSigCallingConvention intCall;
                
            if (returnType == null)
            {
                returnType = typeof(void);
            }            

            intCall = MdSigCallingConvention.Default;

            if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
                intCall = MdSigCallingConvention.Vararg;

            if (cGenericParam > 0)
            {
                intCall |= MdSigCallingConvention.Generic;
            }

            if ((callingConvention & CallingConventions.HasThis) == CallingConventions.HasThis)
                intCall |= MdSigCallingConvention.HasThis;

            sigHelp = new SignatureHelper(scope, intCall, cGenericParam, returnType, 
                                            requiredReturnTypeCustomModifiers, optionalReturnTypeCustomModifiers);            
            sigHelp.AddArguments(parameterTypes, requiredParameterTypeCustomModifiers, optionalParameterTypeCustomModifiers);

            return sigHelp;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:32,代码来源:SignatureHelper.cs

示例13: TypeValueInfo

        public Module Module;                // ex RunCode_00002.dll

        public TypeValueInfo(Type sourceType, MemberInfo memberInfo)
        {
            SourceType = sourceType;
            Name = memberInfo.Name;
            TreeName = memberInfo.Name;
            ParentName = null;

            Type valueType = memberInfo.zGetValueType();
            Type enumerableType = null;
            if (valueType != typeof(string))
                enumerableType = zReflection.GetEnumerableType(valueType);
            if (enumerableType != null)
            {
                ValueType = enumerableType;
                IsEnumerable = true;
            }
            else
            {
                ValueType = valueType;
                IsEnumerable = false;
            }

            IsValueType = TypeReflection.IsValueType(ValueType);
            DeclaringType = memberInfo.DeclaringType;
            ReflectedType = memberInfo.ReflectedType;
            MemberTypes = memberInfo.MemberType;
            MetadataToken = memberInfo.MetadataToken;
            Module = memberInfo.Module;
        }
开发者ID:labeuze,项目名称:source,代码行数:31,代码来源:TypeReflection.cs

示例14: YetiCsharpConstructor

 public YetiCsharpConstructor(Type t, ConstructorInfo cons, ParameterInfo[] par, Module mod)
 {
     this.ci = cons;
     this.parameters = par;
     this.type = t;
     this.module = mod;
 }
开发者ID:Haegin,项目名称:York-Extensible-Testing-Infrastructure,代码行数:7,代码来源:YetiCsharpConstructor.cs

示例15: CollectErrorsOnMemberAndDescendents

        private static IEnumerable<string> CollectErrorsOnMemberAndDescendents(Module module, IEnumerable<Exemption> exemptions, Func<ICustomAttributeProvider, string, string, IEnumerable<Exemption>, IEnumerable<string>> coreChecker) {
            var types = module.GetTypes().Where(type => !IsGeneratedCode(type));

            return Enumerable.Concat(
                coreChecker(module, module.Name, "module", exemptions),
                types.SelectMany(type => CollectErrorsOnMemberAndDescendents(type, exemptions, coreChecker)));
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:7,代码来源:SuppressMessageUtil.cs


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