• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Reflection.Module类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Compile

        public void Compile(Module module)
        {
            var path = module.VirtualPath;
            var file = path.ResolvePath();
            var asm = Assembly.LoadFrom(file);
            // TODO: Handle assembly dependencies
            var type = asm.GetType("ShipScript.Loader", false);
            if (type != null)
            {
                var method = type.GetMethod("Load", BindingFlags.Static | BindingFlags.Public, null, Type.EmptyTypes, null);
                if (method.ReturnType == typeof (void))
                {
                    method.Invoke(null, null);
                    module.Exports = new ReflectableAssembly(asm);
                }
                else
                {
                    module.Exports = method.Invoke(null, null);
                }
            }
            else
            {
                module.Exports = new ReflectableAssembly(asm);
            }

            module.Loaded = true;
        }
开发者ID:furesoft,项目名称:RShipCore,代码行数:27,代码来源:DllCompiler.cs


示例17: RuntimeHandle

 public RuntimeHandle(Module module, Type type, MethodBase method, int metadataToken)
 {
     Module = module;
     Type = type;
     Method = method;
     MetadataToken = metadataToken;
 }
开发者ID:xeno-by,项目名称:truesight-lite,代码行数:7,代码来源:RuntimeHandle.cs


示例18: method_3

 // Token: 0x06002E87 RID: 11911
 // RVA: 0x0012E4A4 File Offset: 0x0012C6A4
 private void method_3(Module module_0)
 {
     byte[] array = this.byte_0;
     int i = 0;
     this.list_0 = new List<Class775>();
     while (i < array.Length)
     {
         Class775 class = new Class775();
开发者ID:newchild,项目名称:Project-DayZero,代码行数:10,代码来源:Class776.cs


示例19: MethodBaseModuleContext

        public MethodBaseModuleContext(MethodBase method)
        {
            this.module = method.Module;
            this.methodGenericArguments = (method.IsGenericMethod || method.IsGenericMethodDefinition) ? method.GetGenericArguments() : new Type[0];

            var type = method.DeclaringType;
            this.typeGenericArguments = (type != null && (type.IsGenericType || type.IsGenericTypeDefinition)) ? type.GetGenericArguments() : new Type[0];
        }
开发者ID:ashmind,项目名称:expressive,代码行数:8,代码来源:MethodBaseModuleContext.cs


示例20: Check

 public Resolution Check(Module module, FieldInfo field)
 {
     if (!field.IsStatic && (field.IsPublic || field.IsAssembly)) {
         // FIXME: I18N
         return new Resolution (this, String.Format ("Make the field <code>{0}</code> in the type <code>{1}</code> private or protected. Provide a public or internal property if the field should be accessed from outside.", field.Name, field.DeclaringType.FullName), NamingUtilities.Combine (field.DeclaringType.FullName, field.Name));
     }
     return null;
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:8,代码来源:TypesHaveNoPublicInstanceFields.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Reflection.ParameterInfo类代码示例发布时间:2022-05-26
下一篇:
C# Reflection.MethodInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap