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

C# Reflection.RuntimeParameterInfo类代码示例

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

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



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

示例1: GetCustomAttribute

 internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter)
 {
     if (!parameter.IsOptional)
     {
         return null;
     }
     return new OptionalAttribute();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:OptionalAttribute.cs


示例2: RuntimeParameterInfo

 private RuntimeParameterInfo(RuntimeParameterInfo accessor, MemberInfo member)
 {
     base.MemberImpl = member;
     this.m_originalMember = accessor.MemberImpl as MethodBase;
     base.NameImpl = accessor.Name;
     this.m_nameIsCached = true;
     base.ClassImpl = accessor.ParameterType;
     base.PositionImpl = accessor.Position;
     base.AttrsImpl = accessor.Attributes;
     this.m_tkParamDef = System.Reflection.MetadataToken.IsNullToken(accessor.MetadataToken) ? 0x8000000 : accessor.MetadataToken;
     this.m_scope = accessor.m_scope;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:RuntimeParameterInfo.cs


示例3: GetCustomAttributes

 internal static Attribute[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, out int count)
 {
     count = 0;
     bool flag = (caType == ((RuntimeType) typeof(object))) || (caType == ((RuntimeType) typeof(Attribute)));
     if (!flag && (s_pca.GetValueOrDefault(caType) == null))
     {
         return null;
     }
     Attribute[] attributeArray = new Attribute[s_pcasCount];
     Attribute customAttribute = null;
     if (flag || (caType == ((RuntimeType) typeof(InAttribute))))
     {
         customAttribute = InAttribute.GetCustomAttribute(parameter);
         if (customAttribute != null)
         {
             attributeArray[count++] = customAttribute;
         }
     }
     if (flag || (caType == ((RuntimeType) typeof(OutAttribute))))
     {
         customAttribute = OutAttribute.GetCustomAttribute(parameter);
         if (customAttribute != null)
         {
             attributeArray[count++] = customAttribute;
         }
     }
     if (flag || (caType == ((RuntimeType) typeof(OptionalAttribute))))
     {
         customAttribute = OptionalAttribute.GetCustomAttribute(parameter);
         if (customAttribute != null)
         {
             attributeArray[count++] = customAttribute;
         }
     }
     if (flag || (caType == ((RuntimeType) typeof(MarshalAsAttribute))))
     {
         customAttribute = MarshalAsAttribute.GetCustomAttribute(parameter);
         if (customAttribute != null)
         {
             attributeArray[count++] = customAttribute;
         }
     }
     return attributeArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:PseudoCustomAttribute.cs


示例4: IsDefined

 internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
 {
     bool flag = (caType == ((RuntimeType) typeof(object))) || (caType == ((RuntimeType) typeof(Attribute)));
     if (!flag && (s_pca.GetValueOrDefault(caType) == null))
     {
         return false;
     }
     return (((flag || (caType == ((RuntimeType) typeof(InAttribute)))) && InAttribute.IsDefined(parameter)) || (((flag || (caType == ((RuntimeType) typeof(OutAttribute)))) && OutAttribute.IsDefined(parameter)) || (((flag || (caType == ((RuntimeType) typeof(OptionalAttribute)))) && OptionalAttribute.IsDefined(parameter)) || ((flag || (caType == ((RuntimeType) typeof(MarshalAsAttribute)))) && MarshalAsAttribute.IsDefined(parameter)))));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:PseudoCustomAttribute.cs


示例5: GetReflectionCachedData

        }// GetCachedRemotingAttribute
 
        internal static RemotingCachedData GetReflectionCachedData(RuntimeParameterInfo reflectionObject) 
        {
            RemotingCachedData cache = null; 
            cache = (RemotingCachedData)reflectionObject.RemotingCache[CacheObjType.RemotingData];
            if (cache == null)
            {
                cache = new RemotingCachedData(reflectionObject); 
                reflectionObject.RemotingCache[CacheObjType.RemotingData] = cache;
            } 
 
            return cache;
        } // GetCachedRemotingAttribute 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:14,代码来源:RemotingServices.cs


示例6: RuntimeParameterInfo

 // used by RuntimePropertyInfo
 internal RuntimeParameterInfo(RuntimeParameterInfo accessor, RuntimePropertyInfo property)
     : this(accessor, (MemberInfo)property)
 {
     m_signature = property.Signature;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:6,代码来源:parameterinfo.cs


示例7: GetCustomAttributesInternal

 internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target)
 {
     IList<CustomAttributeData> customAttributes = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
     int count = 0;
     Attribute[] attributeArray = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out count);
     if (count == 0)
     {
         return customAttributes;
     }
     CustomAttributeData[] array = new CustomAttributeData[customAttributes.Count + count];
     customAttributes.CopyTo(array, count);
     for (int i = 0; i < count; i++)
     {
         array[i] = new CustomAttributeData(attributeArray[i]);
     }
     return Array.AsReadOnly<CustomAttributeData>(array);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:CustomAttributeData.cs


示例8: GetCustomAttribute

 internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter)
 {
     return parameter.IsOptional ? new OptionalAttribute() : null;
 }
开发者ID:razzfazz,项目名称:mono,代码行数:4,代码来源:attributes.cs


示例9: IsDefined

 [System.Security.SecurityCritical]  // auto-generated
 internal static bool IsDefined(RuntimeParameterInfo parameter)
 {
     return GetCustomAttribute(parameter) != null;
 }
开发者ID:razzfazz,项目名称:mono,代码行数:5,代码来源:attributes.cs


示例10: IsDefined

        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
        {
            bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);
            if (!all && s_pca.GetValueOrDefault(caType) == null)
                return false;


            if (all || caType == (RuntimeType)typeof(InAttribute))
            {
                if (InAttribute.IsDefined(parameter)) return true;
            }
            if (all || caType == (RuntimeType)typeof(OutAttribute))
            {
                if (OutAttribute.IsDefined(parameter)) return true;
            }
            if (all || caType == (RuntimeType)typeof(OptionalAttribute))
            {
                if (OptionalAttribute.IsDefined(parameter)) return true;
            }
            if (all || caType == (RuntimeType)typeof(MarshalAsAttribute))
            {
                if (MarshalAsAttribute.IsDefined(parameter)) return true;
            }

            return false;
        }
开发者ID:enavro,项目名称:coreclr,代码行数:27,代码来源:CustomAttribute.cs


示例11: IsDefined

        [System.Security.SecurityCritical]  // auto-generated
        internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
        {
            Contract.Requires(parameter != null);
            Contract.Requires(caType != null);

#if !FEATURE_CORECLR
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled(EventLevel.Informational, FrameworkEventSource.Keywords.DynamicTypeUsage) && caType != null)
            {
                FrameworkEventSource.Log.QueryAttributeIsDefined(caType.GetFullNameForEtw());
            }
#endif

            if (PseudoCustomAttribute.IsDefined(parameter, caType))
                return true;

            return IsCustomAttributeDefined(parameter.GetRuntimeModule(), parameter.MetadataToken, caType);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:18,代码来源:CustomAttribute.cs


示例12: GetReflectionCachedData

 internal static RemotingCachedData GetReflectionCachedData(RuntimeParameterInfo reflectionObject)
 {
     return reflectionObject.RemotingCache;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:remotingservices.cs


示例13: GetIndexParametersNoCopy

 internal ParameterInfo[] GetIndexParametersNoCopy()
 {
     if (this.m_parameters == null)
     {
         int length = 0;
         ParameterInfo[] parametersNoCopy = null;
         MethodInfo getMethod = this.GetGetMethod(true);
         if (getMethod != null)
         {
             parametersNoCopy = getMethod.GetParametersNoCopy();
             length = parametersNoCopy.Length;
         }
         else
         {
             getMethod = this.GetSetMethod(true);
             if (getMethod != null)
             {
                 parametersNoCopy = getMethod.GetParametersNoCopy();
                 length = parametersNoCopy.Length - 1;
             }
         }
         ParameterInfo[] infoArray2 = new ParameterInfo[length];
         for (int i = 0; i < length; i++)
         {
             infoArray2[i] = new RuntimeParameterInfo((RuntimeParameterInfo) parametersNoCopy[i], this);
         }
         this.m_parameters = infoArray2;
     }
     return this.m_parameters;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:RuntimePropertyInfo.cs


示例14: GetParameters

 internal static unsafe ParameterInfo[] GetParameters(IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, out ParameterInfo returnParameter, bool fetchReturnParameter)
 {
     returnParameter = null;
     int length = sig.Arguments.Length;
     ParameterInfo[] infoArray = fetchReturnParameter ? null : new ParameterInfo[length];
     int methodDef = RuntimeMethodHandle.GetMethodDef(methodHandle);
     int count = 0;
     if (!System.Reflection.MetadataToken.IsNullToken(methodDef))
     {
         MetadataImport metadataImport = RuntimeTypeHandle.GetMetadataImport(RuntimeMethodHandle.GetDeclaringType(methodHandle));
         count = metadataImport.EnumParamsCount(methodDef);
         int* result = (int*) stackalloc byte[(((IntPtr) count) * 4)];
         metadataImport.EnumParams(methodDef, result, count);
         if (count > (length + 1))
         {
             throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
         }
         for (uint i = 0; i < count; i++)
         {
             ParameterAttributes attributes;
             int num5;
             int parameterToken = result[(int) ((int*) i)];
             metadataImport.GetParamDefProps(parameterToken, out num5, out attributes);
             num5--;
             if (fetchReturnParameter && (num5 == -1))
             {
                 if (returnParameter != null)
                 {
                     throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
                 }
                 returnParameter = new RuntimeParameterInfo(sig, metadataImport, parameterToken, num5, attributes, member);
             }
             else if (!fetchReturnParameter && (num5 >= 0))
             {
                 if (num5 >= length)
                 {
                     throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
                 }
                 infoArray[num5] = new RuntimeParameterInfo(sig, metadataImport, parameterToken, num5, attributes, member);
             }
         }
     }
     if (fetchReturnParameter)
     {
         if (returnParameter == null)
         {
             returnParameter = new RuntimeParameterInfo(sig, MetadataImport.EmptyImport, 0, -1, ParameterAttributes.None, member);
         }
         return infoArray;
     }
     if (count < (infoArray.Length + 1))
     {
         for (int j = 0; j < infoArray.Length; j++)
         {
             if (infoArray[j] == null)
             {
                 infoArray[j] = new RuntimeParameterInfo(sig, MetadataImport.EmptyImport, 0, j, ParameterAttributes.None, member);
             }
         }
     }
     return infoArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:62,代码来源:RuntimeParameterInfo.cs


示例15: RemotingCachedData

 internal RemotingCachedData(RuntimeParameterInfo ri)
 {
     this.RI = ri;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:RemotingCachedData.cs


示例16: GetCustomAttributesInternal

        [System.Security.SecuritySafeCritical]  // auto-generated
        internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeParameterInfo target)
        {
            Contract.Assert(target != null);

            IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);

            int pcaCount = 0;
            Attribute[] a = PseudoCustomAttribute.GetCustomAttributes(target, typeof(object) as RuntimeType, out pcaCount);

            if (pcaCount == 0)
                return cad;

            CustomAttributeData[] pca = new CustomAttributeData[cad.Count + pcaCount];
            cad.CopyTo(pca, pcaCount);
            for (int i = 0; i < pcaCount; i++)
                pca[i] = new CustomAttributeData(a[i]);

            return Array.AsReadOnly(pca);
        }
开发者ID:enavro,项目名称:coreclr,代码行数:20,代码来源:CustomAttribute.cs


示例17: GetCustomAttributes

        [System.Security.SecurityCritical]  // auto-generated
        internal static Attribute[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, out int count)
        {
            Contract.Requires(parameter != null);
            Contract.Requires(caType != null);

            count = 0;

            bool all = caType == (RuntimeType)typeof(object) || caType == (RuntimeType)typeof(Attribute);
            if (!all && s_pca.GetValueOrDefault(caType) == null)
                return null;

            Attribute[] pcas = new Attribute[s_pcasCount];
            Attribute pca = null;

            if (all || caType == (RuntimeType)typeof(InAttribute))
            {
                pca = InAttribute.GetCustomAttribute(parameter);
                if (pca != null) pcas[count++] = pca;
            }
            if (all || caType == (RuntimeType)typeof(OutAttribute))
            {
                pca = OutAttribute.GetCustomAttribute(parameter);
                if (pca != null) pcas[count++] = pca;
            }
            if (all || caType == (RuntimeType)typeof(OptionalAttribute))
            {
                pca = OptionalAttribute.GetCustomAttribute(parameter);
                if (pca != null) pcas[count++] = pca;
            }
            if (all || caType == (RuntimeType)typeof(MarshalAsAttribute))
            {
                pca = MarshalAsAttribute.GetCustomAttribute(parameter);
                if (pca != null) pcas[count++] = pca;
            }
            return pcas;
        }
开发者ID:enavro,项目名称:coreclr,代码行数:37,代码来源:CustomAttribute.cs


示例18: RemotingParameterCachedData

        private RuntimeParameterInfo RI;  // reflection structure on which this data structure is stored

        internal RemotingParameterCachedData(RuntimeParameterInfo ri)
        {
            RI = ri;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:6,代码来源:RemotingAttributes.cs


示例19: GetIndexParametersNoCopy

        internal ParameterInfo[] GetIndexParametersNoCopy()
        {
            // @History - Logic ported from RTM

            // No need to lock because we don't guarantee the uniqueness of ParameterInfo objects
            if (m_parameters == null)
            {
                int numParams = 0;
                ParameterInfo[] methParams = null;

                // First try to get the Get method.
                MethodInfo m = GetGetMethod(true);
                if (m != null)
                {
                    // There is a Get method so use it.
                    methParams = m.GetParametersNoCopy();
                    numParams = methParams.Length;
                }
                else
                {
                    // If there is no Get method then use the Set method.
                    m = GetSetMethod(true);

                    if (m != null)
                    {
                        methParams = m.GetParametersNoCopy();
                        numParams = methParams.Length - 1;
                    }
                }

                // Now copy over the parameter info's and change their 
                // owning member info to the current property info.

                ParameterInfo[] propParams = new ParameterInfo[numParams];

                for (int i = 0; i < numParams; i++)
                    propParams[i] = new RuntimeParameterInfo((RuntimeParameterInfo)methParams[i], this);

                m_parameters = propParams;
            }

            return m_parameters;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:43,代码来源:propertyinfo.cs


示例20: LoadParameters

 internal ParameterInfo[] LoadParameters()
 {
     if (this.m_parameters == null)
     {
         Type[] parameterTypes = this.m_owner.m_parameterTypes;
         ParameterInfo[] infoArray = new ParameterInfo[parameterTypes.Length];
         for (int i = 0; i < parameterTypes.Length; i++)
         {
             infoArray[i] = new RuntimeParameterInfo(this, null, parameterTypes[i], i);
         }
         if (this.m_parameters == null)
         {
             this.m_parameters = infoArray;
         }
     }
     return this.m_parameters;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:DynamicMethod.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Reflection.StrongNameKeyPair类代码示例发布时间:2022-05-26
下一篇:
C# Reflection.RuntimeModule类代码示例发布时间: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