Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MdFieldInfo.cs
Go to the documentation of this file.
3
4namespace System.Reflection;
5
6internal sealed class MdFieldInfo : RuntimeFieldInfo
7{
8 private int m_tkField;
9
10 private string m_name;
11
13
15
17
18 public override int MetadataToken => m_tkField;
19
21 {
22 get
23 {
24 throw new NotSupportedException();
25 }
26 }
27
29
31
33
35
36 public unsafe override Type FieldType
37 {
38 get
39 {
40 if (m_fieldType == null)
41 {
43 m_fieldType = new Signature(sigOfFieldDef.Signature.ToPointer(), sigOfFieldDef.Length, m_declaringType).FieldType;
44 }
45 return m_fieldType;
46 }
47 }
48
49 internal MdFieldInfo(int tkField, FieldAttributes fieldAttributes, RuntimeTypeHandle declaringTypeHandle, RuntimeType.RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
50 : base(reflectedTypeCache, declaringTypeHandle.GetRuntimeType(), bindingFlags)
51 {
52 m_tkField = tkField;
53 m_name = null;
54 m_fieldAttributes = fieldAttributes;
55 }
56
57 internal override bool CacheEquals(object o)
58 {
59 if (o is MdFieldInfo mdFieldInfo && mdFieldInfo.m_tkField == m_tkField)
60 {
61 return m_declaringType.GetTypeHandleInternal().GetModuleHandle().Equals(mdFieldInfo.m_declaringType.GetTypeHandleInternal().GetModuleHandle());
62 }
63 return false;
64 }
65
66 internal override RuntimeModule GetRuntimeModule()
67 {
69 }
70
71 [DebuggerStepThrough]
72 [DebuggerHidden]
73 public override object GetValueDirect(TypedReference obj)
74 {
75 return GetValue(null);
76 }
77
78 [DebuggerStepThrough]
79 [DebuggerHidden]
80 public override void SetValueDirect(TypedReference obj, object value)
81 {
83 }
84
85 [DebuggerStepThrough]
86 [DebuggerHidden]
87 public override object GetValue(object obj)
88 {
89 return GetValue(raw: false);
90 }
91
92 public override object GetRawConstantValue()
93 {
94 return GetValue(raw: true);
95 }
96
97 private object GetValue(bool raw)
98 {
100 if (value == DBNull.Value)
101 {
103 }
104 return value;
105 }
106
107 [DebuggerStepThrough]
108 [DebuggerHidden]
109 public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
110 {
112 }
113
115 {
116 return Type.EmptyTypes;
117 }
118
120 {
121 return Type.EmptyTypes;
122 }
123}
static readonly DBNull Value
Definition DBNull.cs:8
static unsafe object GetValue(MetadataImport scope, int token, RuntimeTypeHandle fieldTypeHandle, bool raw)
Definition MdConstant.cs:5
MdFieldInfo(int tkField, FieldAttributes fieldAttributes, RuntimeTypeHandle declaringTypeHandle, RuntimeType.RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
override FieldAttributes Attributes
FieldAttributes m_fieldAttributes
override Type[] GetRequiredCustomModifiers()
override object GetValue(object obj)
override bool IsSecuritySafeCritical
override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
override void SetValueDirect(TypedReference obj, object value)
override RuntimeModule GetRuntimeModule()
override Type[] GetOptionalCustomModifiers()
unsafe override Type FieldType
override object GetRawConstantValue()
override RuntimeFieldHandle FieldHandle
override bool CacheEquals(object o)
override bool IsSecurityTransparent
override object GetValueDirect(TypedReference obj)
RuntimeModule GetRuntimeModule()
static string Arg_EnumLitValueNotFound
Definition SR.cs:146
static string Acc_ReadOnly
Definition SR.cs:38
Definition SR.cs:7
virtual RuntimeTypeHandle GetTypeHandleInternal()
Definition Type.cs:449
virtual bool IsSecurityCritical
Definition Type.cs:245
virtual bool IsSecuritySafeCritical
Definition Type.cs:253
virtual bool IsSecurityTransparent
Definition Type.cs:261
static readonly Type[] EmptyTypes
Definition Type.cs:19
unsafe void * ToPointer()
Definition IntPtr.cs:210
unsafe override string ToString()
override bool Equals([NotNullWhen(true)] object? obj)
ConstArray GetSigOfFieldDef(int fieldToken)
unsafe MdUtf8String GetName(int mdToken)