Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ParameterInfo.cs
Go to the documentation of this file.
3
4namespace System.Reflection;
5
7{
9
10 protected Type? ClassImpl;
11
12 protected object? DefaultValueImpl;
13
15
16 protected string? NameImpl;
17
18 protected int PositionImpl;
19
21
22 public virtual MemberInfo Member => MemberImpl;
23
24 public virtual string? Name => NameImpl;
25
26 public virtual Type ParameterType => ClassImpl;
27
28 public virtual int Position => PositionImpl;
29
30 public bool IsIn => (Attributes & ParameterAttributes.In) != 0;
31
32 public bool IsLcid => (Attributes & ParameterAttributes.Lcid) != 0;
33
34 public bool IsOptional => (Attributes & ParameterAttributes.Optional) != 0;
35
36 public bool IsOut => (Attributes & ParameterAttributes.Out) != 0;
37
38 public bool IsRetval => (Attributes & ParameterAttributes.Retval) != 0;
39
40 public virtual object? DefaultValue
41 {
42 get
43 {
45 }
46 }
47
48 public virtual object? RawDefaultValue
49 {
50 get
51 {
53 }
54 }
55
56 public virtual bool HasDefaultValue
57 {
58 get
59 {
61 }
62 }
63
65
66 public virtual int MetadataToken => 134217728;
67
68 protected ParameterInfo()
69 {
70 }
71
72 public virtual bool IsDefined(Type attributeType, bool inherit)
73 {
74 if (attributeType == null)
75 {
76 throw new ArgumentNullException("attributeType");
77 }
78 return false;
79 }
80
85
86 public virtual object[] GetCustomAttributes(bool inherit)
87 {
88 return Array.Empty<object>();
89 }
90
91 public virtual object[] GetCustomAttributes(Type attributeType, bool inherit)
92 {
93 if (attributeType == null)
94 {
95 throw new ArgumentNullException("attributeType");
96 }
97 return Array.Empty<object>();
98 }
99
101 {
102 return Type.EmptyTypes;
103 }
104
106 {
107 return Type.EmptyTypes;
108 }
109
110 public object GetRealObject(StreamingContext context)
111 {
112 if (MemberImpl == null)
113 {
115 }
116 switch (MemberImpl.MemberType)
117 {
118 case MemberTypes.Constructor:
119 case MemberTypes.Method:
120 {
121 if (PositionImpl == -1)
122 {
123 if (MemberImpl.MemberType == MemberTypes.Method)
124 {
125 return ((MethodInfo)MemberImpl).ReturnParameter;
126 }
128 }
129 ParameterInfo[] indexParameters = ((MethodBase)MemberImpl).GetParametersNoCopy();
130 if (indexParameters != null && PositionImpl < indexParameters.Length)
131 {
133 }
135 }
136 case MemberTypes.Property:
137 {
138 ParameterInfo[] indexParameters = ((PropertyInfo)MemberImpl).GetIndexParameters();
139 if (indexParameters != null && PositionImpl > -1 && PositionImpl < indexParameters.Length)
140 {
142 }
144 }
145 default:
147 }
148 }
149
150 public override string ToString()
151 {
152 string text = ParameterType.FormatTypeName();
153 string name = Name;
154 if (name != null)
155 {
156 return text + " " + name;
157 }
158 return text;
159 }
160}
static Exception ByDesign
virtual object[] GetCustomAttributes(Type attributeType, bool inherit)
virtual Type[] GetRequiredCustomModifiers()
virtual Type[] GetOptionalCustomModifiers()
ParameterAttributes AttrsImpl
virtual IList< CustomAttributeData > GetCustomAttributesData()
virtual bool IsDefined(Type attributeType, bool inherit)
virtual IEnumerable< CustomAttributeData > CustomAttributes
virtual object[] GetCustomAttributes(bool inherit)
object GetRealObject(StreamingContext context)
static string Serialization_NoParameterInfo
Definition SR.cs:1896
static string Serialization_BadParameterInfo
Definition SR.cs:1870
static string Serialization_InsufficientState
Definition SR.cs:1878
Definition SR.cs:7
static readonly Type[] EmptyTypes
Definition Type.cs:19