Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TypeToCustomAttributeEncoding()

static CustomAttributeEncoding System.Reflection.RuntimeCustomAttributeData.TypeToCustomAttributeEncoding ( RuntimeType type)
inlinestaticprivate

Definition at line 166 of file RuntimeCustomAttributeData.cs.

167 {
168 if (type == typeof(int))
169 {
170 return CustomAttributeEncoding.Int32;
171 }
172 if (type.IsEnum)
173 {
174 return CustomAttributeEncoding.Enum;
175 }
176 if (type == typeof(string))
177 {
178 return CustomAttributeEncoding.String;
179 }
180 if (type == typeof(Type))
181 {
182 return CustomAttributeEncoding.Type;
183 }
184 if (type == typeof(object))
185 {
186 return CustomAttributeEncoding.Object;
187 }
188 if (type.IsArray)
189 {
190 return CustomAttributeEncoding.Array;
191 }
192 if (type == typeof(char))
193 {
194 return CustomAttributeEncoding.Char;
195 }
196 if (type == typeof(bool))
197 {
198 return CustomAttributeEncoding.Boolean;
199 }
200 if (type == typeof(byte))
201 {
202 return CustomAttributeEncoding.Byte;
203 }
204 if (type == typeof(sbyte))
205 {
206 return CustomAttributeEncoding.SByte;
207 }
208 if (type == typeof(short))
209 {
210 return CustomAttributeEncoding.Int16;
211 }
212 if (type == typeof(ushort))
213 {
214 return CustomAttributeEncoding.UInt16;
215 }
216 if (type == typeof(uint))
217 {
218 return CustomAttributeEncoding.UInt32;
219 }
220 if (type == typeof(long))
221 {
222 return CustomAttributeEncoding.Int64;
223 }
224 if (type == typeof(ulong))
225 {
226 return CustomAttributeEncoding.UInt64;
227 }
228 if (type == typeof(float))
229 {
230 return CustomAttributeEncoding.Float;
231 }
232 if (type == typeof(double))
233 {
234 return CustomAttributeEncoding.Double;
235 }
236 if (type == typeof(Enum))
237 {
238 return CustomAttributeEncoding.Object;
239 }
240 if (type.IsClass)
241 {
242 return CustomAttributeEncoding.Object;
243 }
244 if (type.IsInterface)
245 {
246 return CustomAttributeEncoding.Object;
247 }
248 if (type.IsValueType)
249 {
250 return CustomAttributeEncoding.Undefined;
251 }
252 throw new ArgumentException(SR.Argument_InvalidKindOfTypeForCA, "type");
253 }

References System.SR.Argument_InvalidKindOfTypeForCA, and System.type.

Referenced by System.Reflection.RuntimeCustomAttributeData.InitCustomAttributeType().