本文整理汇总了C#中System.Reflection.RuntimeFieldInfo类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeFieldInfo类的具体用法?C# RuntimeFieldInfo怎么用?C# RuntimeFieldInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeFieldInfo类属于System.Reflection命名空间,在下文中一共展示了RuntimeFieldInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCustomAttribute
internal static Attribute GetCustomAttribute(RuntimeFieldInfo field)
{
if ((field.Attributes & FieldAttributes.NotSerialized) == 0)
return null;
return new NonSerializedAttribute();
}
示例2: SerializationFieldInfo
internal SerializationFieldInfo(RuntimeFieldInfo field, String namePrefix) {
BCLDebug.Assert(field!=null, "[SerializationFieldInfo.ctor]field!=null");
BCLDebug.Assert(namePrefix!=null, "[SerializationFieldInfo.ctor]namePrefix!=null");
m_field = field;
m_serializationName = String.Concat(namePrefix, FakeNameSeparatorString, m_field.Name);
}
示例3: GetCustomAttribute
internal static Attribute GetCustomAttribute(RuntimeFieldInfo field)
{
if ((field.Attributes & FieldAttributes.NotSerialized) == FieldAttributes.PrivateScope)
{
return null;
}
return new NonSerializedAttribute();
}
示例4: AllowCriticalCustomAttributes
private static bool AllowCriticalCustomAttributes(RuntimeFieldInfo field)
{
if (field.IsSecurityTransparent)
{
return SpecialAllowCriticalAttributes((RuntimeType) field.DeclaringType);
}
return true;
}
示例5: GetCustomAttribute
internal static Attribute GetCustomAttribute(RuntimeFieldInfo field)
{
int num;
if ((field.DeclaringType != null) && field.GetRuntimeModule().MetadataImport.GetFieldOffset(field.DeclaringType.MetadataToken, field.MetadataToken, out num))
{
return new FieldOffsetAttribute(num);
}
return null;
}
示例6: GetCustomAttributes
internal static Attribute[] GetCustomAttributes(RuntimeFieldInfo field, 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(MarshalAsAttribute))))
{
customAttribute = MarshalAsAttribute.GetCustomAttribute(field);
if (customAttribute != null)
{
attributeArray[count++] = customAttribute;
}
}
if (flag || (caType == ((RuntimeType) typeof(FieldOffsetAttribute))))
{
customAttribute = FieldOffsetAttribute.GetCustomAttribute(field);
if (customAttribute != null)
{
attributeArray[count++] = customAttribute;
}
}
if (flag || (caType == ((RuntimeType) typeof(NonSerializedAttribute))))
{
customAttribute = NonSerializedAttribute.GetCustomAttribute(field);
if (customAttribute != null)
{
attributeArray[count++] = customAttribute;
}
}
return attributeArray;
}
示例7: GetCustomAttributes
[System.Security.SecuritySafeCritical] // auto-generated
internal static Object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType)
{
Contract.Requires(field != null);
Contract.Requires(caType != null);
int pcaCount = 0;
Attribute[] pca = PseudoCustomAttribute.GetCustomAttributes(field, caType, out pcaCount);
object[] attributes = GetCustomAttributes(field.GetRuntimeModule(), field.MetadataToken, pcaCount, caType, !AllowCriticalCustomAttributes(field));
if (pcaCount > 0) Array.Copy(pca, 0, attributes, attributes.Length - pcaCount, pcaCount);
return attributes;
}
示例8: IsDefined
[System.Security.SecurityCritical] // auto-generated
internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
{
Contract.Requires(field != null);
Contract.Requires(caType != null);
if (PseudoCustomAttribute.IsDefined(field, caType))
return true;
return IsCustomAttributeDefined(field.GetRuntimeModule(), field.MetadataToken, caType);
}
示例9: GetTokenFor
private int GetTokenFor(RuntimeFieldInfo runtimeField, RuntimeType rtType)
{
#if FEATURE_APPX
if (ProfileAPICheck)
{
RtFieldInfo rtField = runtimeField as RtFieldInfo;
if (rtField != null && (rtField.InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != 0)
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", rtField.FullName));
if ((rtType.InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != 0)
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", rtType.FullName));
}
#endif
return m_scope.GetTokenFor(runtimeField.FieldHandle, rtType.TypeHandle);
}
示例10: RemotingFieldCachedData
internal RemotingFieldCachedData(RuntimeFieldInfo ri)
{
}
示例11: IsDefined
internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
{
ASSERT.PRECONDITION(field != null);
if (PseudoCustomAttribute.IsDefined(field, caType))
return true;
return IsCustomAttributeDefined(field.Module, field.MetadataToken, caType);
}
示例12: GetCustomAttributesInternal
[System.Security.SecuritySafeCritical] // auto-generated
internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeFieldInfo target)
{
Contract.Assert(target != null);
IList<CustomAttributeData> cad = GetCustomAttributes(target.GetRuntimeModule(), target.MetadataToken);
int pcaCount = 0;
Attribute[] a = PseudoCustomAttribute.GetCustomAttributes((RuntimeFieldInfo)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);
}
示例13: GetCustomAttribute
[System.Security.SecurityCritical] // auto-generated
internal static Attribute GetCustomAttribute(RuntimeFieldInfo field)
{
int fieldOffset;
if (field.DeclaringType != null &&
#if MONO
(fieldOffset = field.GetFieldOffset ()) >= 0)
#else
field.GetRuntimeModule().MetadataImport.GetFieldOffset(field.DeclaringType.MetadataToken, field.MetadataToken, out fieldOffset))
#endif
return new FieldOffsetAttribute(fieldOffset);
return null;
}
示例14: RemotingCachedData
internal RemotingCachedData(RuntimeFieldInfo ri)
{
this.RI = ri;
}
示例15: IsDefined
internal static bool IsDefined(RuntimeFieldInfo field)
{
return (field.Attributes & FieldAttributes.NotSerialized) != FieldAttributes.PrivateScope;
}