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


C# Emit.SignatureHelper类代码示例

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


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

示例1: SymbolMethod

        //***********************************************
        //
        // Constructor
        // 
        //***********************************************
        internal SymbolMethod(
            ModuleBuilder mod,
            MethodToken token,
            Type        arrayClass, 
            String      methodName, 
            CallingConventions callingConvention,
            Type        returnType,
            Type[]      parameterTypes)

        {
            m_module = mod;
            m_containingType = arrayClass;
            m_name = methodName;
            m_callingConvention = callingConvention;
            m_returnType = returnType;
            m_mdMethod = token;
            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
            }
            else
                m_parameterTypes = null;    
            m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, returnType, parameterTypes);
        }
开发者ID:ArildF,项目名称:masters,代码行数:30,代码来源:symbolmethod.cs

示例2: SymbolMethod

        internal SymbolMethod(ModuleBuilder mod, MethodToken token, Type arrayClass, String methodName, 
            CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
        {
            // This is a kind of MethodInfo to represent methods for array type of unbaked type

            // Another way to look at this class is as a glorified MethodToken wrapper. At the time of this comment
            // this class is only constructed inside ModuleBuilder.GetArrayMethod and the only interesting thing 
            // passed into it is this MethodToken. The MethodToken was forged using a TypeSpec for an Array type and
            // the name of the method on Array. 
            // As none of the methods on Array have CustomModifiers their is no need to pass those around in here.
            m_mdMethod = token;

            // The ParameterTypes are also a bit interesting in that they may be unbaked TypeBuilders.
            m_returnType = returnType;
            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, 0, m_parameterTypes, 0, parameterTypes.Length);
            }
            else
            {
                m_parameterTypes = EmptyArray<Type>.Value; 
            }
   
            m_module = mod;
            m_containingType = arrayClass;
            m_name = methodName;
            m_callingConvention = callingConvention;

            m_signature = SignatureHelper.GetMethodSigHelper(
                mod, callingConvention, returnType, null, null, parameterTypes, null, null);
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:32,代码来源:SymbolMethod.cs

示例3: PropertyBuilder

 // Constructs a PropertyBuilder.  
 //
 internal PropertyBuilder(
     ModuleBuilder       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");
     Contract.EndContractBlock();
     
     m_name = name;
     m_moduleBuilder = mod;
     m_signature = sig;
     m_attributes = attr;
     m_returnType = returnType;
     m_prToken = prToken;
     m_tkProperty = prToken.Token;
     m_containingType = containingType;
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:28,代码来源:PropertyBuilder.cs

示例4: GetMethodSpecSigHelper

 internal static SignatureHelper GetMethodSpecSigHelper(Module scope, Type[] inst)
 {
     SignatureHelper sigHelp = new SignatureHelper(scope, MdSigCallingConvention.GenericInst);
     sigHelp.AddData(inst.Length);
     foreach(Type t in inst)
         sigHelp.AddArgument(t);
     return sigHelp;
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:SignatureHelper.cs

示例5: PropertyBuilder

 internal PropertyBuilder(ModuleBuilder mod, string name, SignatureHelper sig, PropertyAttributes attr, Type returnType, System.Reflection.Emit.PropertyToken prToken, TypeBuilder containingType)
 {
     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");
     }
     this.m_name = name;
     this.m_moduleBuilder = mod;
     this.m_signature = sig;
     this.m_attributes = attr;
     this.m_returnType = returnType;
     this.m_prToken = prToken;
     this.m_tkProperty = prToken.Token;
     this.m_containingType = containingType;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:PropertyBuilder.cs

示例6: ILGenerator

 internal ILGenerator(MethodInfo methodBuilder, int size)
 {
     if (size < 0x10)
     {
         this.m_ILStream = new byte[0x10];
     }
     else
     {
         this.m_ILStream = new byte[size];
     }
     this.m_length = 0;
     this.m_labelCount = 0;
     this.m_fixupCount = 0;
     this.m_labelList = null;
     this.m_fixupData = null;
     this.m_exceptions = null;
     this.m_exceptionCount = 0;
     this.m_currExcStack = null;
     this.m_currExcStackCount = 0;
     this.m_RelocFixupList = new int[0x40];
     this.m_RelocFixupCount = 0;
     this.m_RVAFixupList = new int[0x40];
     this.m_RVAFixupCount = 0;
     this.m_ScopeTree = new ScopeTree();
     this.m_LineNumberInfo = new LineNumberInfo();
     this.m_methodBuilder = methodBuilder;
     this.m_localCount = 0;
     MethodBuilder builder = this.m_methodBuilder as MethodBuilder;
     if (builder == null)
     {
         this.m_localSignature = SignatureHelper.GetLocalVarSigHelper(null);
     }
     else
     {
         this.m_localSignature = SignatureHelper.GetLocalVarSigHelper(builder.GetTypeBuilder().Module);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:37,代码来源:ILGenerator.cs

示例7: GetSignatureToken

		public SignatureToken GetSignatureToken (SignatureHelper sigHelper)
		{
			if (sigHelper == null)
				throw new ArgumentNullException ("sigHelper");
			return new SignatureToken (GetToken (sigHelper));
		}
开发者ID:carrie901,项目名称:mono,代码行数:6,代码来源:ModuleBuilder.cs

示例8: GetPropertySigHelper

        /// <include file='doc\SignatureHelper.uex' path='docs/doc[@for="SignatureHelper.GetPropertySigHelper"]/*' />
        public static SignatureHelper GetPropertySigHelper(Module mod, Type returnType, Type[] parameterTypes) 
        {
            SignatureHelper sigHelp;
                
            if (returnType == null)
            {
                returnType = typeof(void);
            }            

            sigHelp = new SignatureHelper(mod, IMAGE_CEE_CS_CALLCONV_PROPERTY, (Type)returnType);
            
            if (parameterTypes != null)
            {
                for (int i=0; i<parameterTypes.Length; i++) 
                {
                    sigHelp.AddArgument(parameterTypes[i]);
                }
            }
            return sigHelp;
        }
开发者ID:ArildF,项目名称:masters,代码行数:21,代码来源:signaturehelper.cs

示例9: GetMethodSigHelper

        /// <include file='doc\SignatureHelper.uex' path='docs/doc[@for="SignatureHelper.GetMethodSigHelper2"]/*' />
        public static SignatureHelper GetMethodSigHelper(
            Module          mod, 
            CallingConvention unmanagedCallConv, 
            Type            returnType) 
        {
            SignatureHelper sigHelp;
            int             intCall;
                
            if (returnType == null)
            {
                returnType = typeof(void);
            }            

            if (unmanagedCallConv ==  CallingConvention.Cdecl)
                intCall = IMAGE_CEE_UNMANAGED_CALLCONV_C;
            else if (unmanagedCallConv ==  CallingConvention.StdCall)
                intCall = IMAGE_CEE_UNMANAGED_CALLCONV_STDCALL;
            else if (unmanagedCallConv ==  CallingConvention.ThisCall)
                intCall = IMAGE_CEE_UNMANAGED_CALLCONV_THISCALL;
            else if (unmanagedCallConv ==  CallingConvention.FastCall)
                intCall = IMAGE_CEE_UNMANAGED_CALLCONV_FASTCALL;
            else
                throw new ArgumentException(Environment.GetResourceString("Argument_UnknownUnmanagedCallConv"), "unmanagedCallConv");                          
            
            sigHelp = new SignatureHelper(mod, intCall, (Type)returnType);
            
            return sigHelp;
        }
开发者ID:ArildF,项目名称:masters,代码行数:29,代码来源:signaturehelper.cs

示例10: GetToken

		public int GetToken (SignatureHelper helper) {
			return m.AddRef (helper);
		}
开发者ID:saga,项目名称:mono,代码行数:3,代码来源:DynamicMethod.cs

示例11: VarArgMethod

 internal VarArgMethod(RuntimeMethodInfo method, SignatureHelper signature)
 {
     m_method = method;
     m_signature = signature;
 }
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:5,代码来源:DynamicILGenerator.cs

示例12: Emit

		public virtual void Emit (OpCode opcode, SignatureHelper signature)
		{
			int token = token_gen.GetToken (signature);
			make_room (6);
			ll_emit (opcode);
			emit_int (token);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:ILGenerator.cs

示例13: Init

        private void Init(String name, MethodAttributes attributes, CallingConventions callingConvention,
            Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
            Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, 
            Module mod, TypeBuilder type, bool bIsGlobalMethod)
        {
            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");

            if (mod == null)
                throw new ArgumentNullException("mod");

            if (parameterTypes != null)
            {
                foreach(Type t in parameterTypes)
                {
                    if (t == null)
                        throw new ArgumentNullException("parameterTypes");
                }
            }

            m_link = type.m_currentMethod;
            type.m_currentMethod = this;
            m_strName = name;
            m_module = mod;
            m_containingType = type;
            m_localSignature = SignatureHelper.GetLocalVarSigHelper(mod);

            // 
            //if (returnType == null)
            //{
            //    m_returnType = typeof(void);
            //}
            //else
            {
                m_returnType = returnType;
            }

            if ((attributes & MethodAttributes.Static) == 0)
            {
                // turn on the has this calling convention
                callingConvention = callingConvention | CallingConventions.HasThis;
            }
            else if ((attributes & MethodAttributes.Virtual) != 0)
            {
                // A method can't be both static and virtual
                throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual"));
            }

            if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName)
            {
                if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface)
                {
                    // methods on interface have to be abstract + virtual except special name methods such as type initializer
                    if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != 
                        (MethodAttributes.Abstract | MethodAttributes.Virtual) &&                         
                        (attributes & MethodAttributes.Static) == 0)
                        throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod"));               
                }
            }

            m_callingConvention = callingConvention;

            if (parameterTypes != null)
            {
                m_parameterTypes = new Type[parameterTypes.Length];
                Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
            }
            else
            {
                m_parameterTypes = null;
            }

            m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers;
            m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers;
            m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
            m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;

//            m_signature = SignatureHelper.GetMethodSigHelper(mod, callingConvention, 
//                returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
//                parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);

            m_iAttributes = attributes;
            m_bIsGlobalMethod = bIsGlobalMethod;
            m_bIsBaked = false;
            m_fInitLocals = true;

            m_localSymInfo = new LocalSymInfo();
            m_ubBody = null;
            m_ilGenerator = null;

            // Default is managed IL. Manged IL has bit flag 0x0020 set off
            m_dwMethodImplFlags = MethodImplAttributes.IL;

            //int i = MetadataTokenInternal;
//.........这里部分代码省略.........
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:101,代码来源:methodbuilder.cs

示例14: GetMethodSignature

        internal SignatureHelper GetMethodSignature()
        {
            if (m_parameterTypes == null)
                m_parameterTypes = new Type[0];

            m_signature = SignatureHelper.GetMethodSigHelper (m_module, m_callingConvention, m_inst != null ? m_inst.Length : 0, 
                m_returnType == null ? typeof(void) : m_returnType, m_returnTypeRequiredCustomModifiers, m_returnTypeOptionalCustomModifiers,
                m_parameterTypes, m_parameterTypeRequiredCustomModifiers, m_parameterTypeOptionalCustomModifiers);

            return m_signature;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:11,代码来源:methodbuilder.cs

示例15: GetMethodSigHelper

        public static SignatureHelper GetMethodSigHelper(Module mod, CallingConvention unmanagedCallConv, Type returnType)
        {
            SignatureHelper sigHelp;
            MdSigCallingConvention intCall;
                
            if (returnType == null)
                returnType = typeof(void);

            if (unmanagedCallConv == CallingConvention.Cdecl)
            {
                intCall = MdSigCallingConvention.C;
            }
            else if (unmanagedCallConv == CallingConvention.StdCall || unmanagedCallConv == CallingConvention.Winapi)
            {
                intCall = MdSigCallingConvention.StdCall;
            }
            else if (unmanagedCallConv == CallingConvention.ThisCall)
            {
                intCall = MdSigCallingConvention.ThisCall;
            }
            else if (unmanagedCallConv == CallingConvention.FastCall)
            {
                intCall = MdSigCallingConvention.FastCall;
            }
            else
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_UnknownUnmanagedCallConv"), nameof(unmanagedCallConv));                          
            }
            
            sigHelp = new SignatureHelper(mod, intCall, returnType, null, null);
            
            return sigHelp;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:33,代码来源:SignatureHelper.cs


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