本文整理汇总了C#中System.Reflection.RuntimeParameterInfo类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeParameterInfo类的具体用法?C# RuntimeParameterInfo怎么用?C# RuntimeParameterInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeParameterInfo类属于System.Reflection命名空间,在下文中一共展示了RuntimeParameterInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCustomAttribute
internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter)
{
if (!parameter.IsOptional)
{
return null;
}
return new OptionalAttribute();
}
示例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;
}
示例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;
}
示例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)))));
}
示例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
示例6: RuntimeParameterInfo
// used by RuntimePropertyInfo
internal RuntimeParameterInfo(RuntimeParameterInfo accessor, RuntimePropertyInfo property)
: this(accessor, (MemberInfo)property)
{
m_signature = property.Signature;
}
示例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);
}
示例8: GetCustomAttribute
internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter)
{
return parameter.IsOptional ? new OptionalAttribute() : null;
}
示例9: IsDefined
[System.Security.SecurityCritical] // auto-generated
internal static bool IsDefined(RuntimeParameterInfo parameter)
{
return GetCustomAttribute(parameter) != null;
}
示例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;
}
示例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);
}
示例12: GetReflectionCachedData
internal static RemotingCachedData GetReflectionCachedData(RuntimeParameterInfo reflectionObject)
{
return reflectionObject.RemotingCache;
}
示例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;
}
示例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;
}
示例15: RemotingCachedData
internal RemotingCachedData(RuntimeParameterInfo ri)
{
this.RI = ri;
}