Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Type.cs
Go to the documentation of this file.
10
11namespace System;
12
13public abstract class Type : MemberInfo, IReflect
14{
15 private static volatile Binder s_defaultBinder;
16
17 public static readonly char Delimiter = '.';
18
19 public static readonly Type[] EmptyTypes = Array.Empty<Type>();
20
21 public static readonly object Missing = System.Reflection.Missing.Value;
22
24
25 public static readonly MemberFilter FilterName = (MemberInfo m, object c) => FilterNameImpl(m, c, StringComparison.Ordinal);
26
27 public static readonly MemberFilter FilterNameIgnoreCase = (MemberInfo m, object c) => FilterNameImpl(m, c, StringComparison.OrdinalIgnoreCase);
28
29 public bool IsInterface
30 {
31 get
32 {
33 if (this is RuntimeType type)
34 {
36 }
37 return (GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.ClassSemanticsMask;
38 }
39 }
40
41 public override MemberTypes MemberType => MemberTypes.TypeInfo;
42
43 public abstract string? Namespace { get; }
44
45 public abstract string? AssemblyQualifiedName { get; }
46
47 public abstract string? FullName { get; }
48
49 public abstract Assembly Assembly { get; }
50
51 public new abstract Module Module { get; }
52
53 public bool IsNested => DeclaringType != null;
54
55 public override Type? DeclaringType => null;
56
57 public virtual MethodBase? DeclaringMethod => null;
58
59 public override Type? ReflectedType => null;
60
61 public abstract Type UnderlyingSystemType { get; }
62
63 public virtual bool IsTypeDefinition
64 {
65 get
66 {
68 }
69 }
70
71 public bool IsArray => IsArrayImpl();
72
73 public bool IsByRef => IsByRefImpl();
74
75 public bool IsPointer => IsPointerImpl();
76
77 public virtual bool IsConstructedGenericType
78 {
79 get
80 {
82 }
83 }
84
85 public virtual bool IsGenericParameter => false;
86
87 public virtual bool IsGenericTypeParameter
88 {
89 get
90 {
92 {
93 return (object)DeclaringMethod == null;
94 }
95 return false;
96 }
97 }
98
99 public virtual bool IsGenericMethodParameter
100 {
101 get
102 {
104 {
105 return DeclaringMethod != null;
106 }
107 return false;
108 }
109 }
110
111 public virtual bool IsGenericType => false;
112
113 public virtual bool IsGenericTypeDefinition => false;
114
115 public virtual bool IsSZArray
116 {
117 get
118 {
120 }
121 }
122
123 public virtual bool IsVariableBoundArray
124 {
125 get
126 {
127 if (IsArray)
128 {
129 return !IsSZArray;
130 }
131 return false;
132 }
133 }
134
135 public virtual bool IsByRefLike
136 {
137 get
138 {
140 }
141 }
142
144
145 public virtual Type[] GenericTypeArguments
146 {
147 get
148 {
150 {
151 return EmptyTypes;
152 }
153 return GetGenericArguments();
154 }
155 }
156
157 public virtual int GenericParameterPosition
158 {
159 get
160 {
162 }
163 }
164
166 {
167 get
168 {
169 throw new NotSupportedException();
170 }
171 }
172
174
175 public bool IsAbstract => (GetAttributeFlagsImpl() & TypeAttributes.Abstract) != 0;
176
177 public bool IsImport => (GetAttributeFlagsImpl() & TypeAttributes.Import) != 0;
178
179 public bool IsSealed => (GetAttributeFlagsImpl() & TypeAttributes.Sealed) != 0;
180
181 public bool IsSpecialName => (GetAttributeFlagsImpl() & TypeAttributes.SpecialName) != 0;
182
183 public bool IsClass
184 {
185 get
186 {
187 if ((GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == 0)
188 {
189 return !IsValueType;
190 }
191 return false;
192 }
193 }
194
195 public bool IsNestedAssembly => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
196
197 public bool IsNestedFamANDAssem => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem;
198
199 public bool IsNestedFamily => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily;
200
201 public bool IsNestedFamORAssem => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.VisibilityMask;
202
203 public bool IsNestedPrivate => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate;
204
205 public bool IsNestedPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic;
206
207 public bool IsNotPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == 0;
208
209 public bool IsPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
210
211 public bool IsAutoLayout => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == 0;
212
213 public bool IsExplicitLayout => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout;
214
215 public bool IsLayoutSequential => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout;
216
217 public bool IsAnsiClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == 0;
218
219 public bool IsAutoClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass;
220
221 public bool IsUnicodeClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass;
222
223 public bool IsCOMObject => IsCOMObjectImpl();
224
226
227 public virtual bool IsEnum => IsSubclassOf(typeof(Enum));
228
230
231 public bool IsPrimitive => IsPrimitiveImpl();
232
233 public bool IsValueType
234 {
235 [Intrinsic]
236 get
237 {
238 return IsValueTypeImpl();
239 }
240 }
241
242 public virtual bool IsSignatureType => false;
243
244 public virtual bool IsSecurityCritical
245 {
246 get
247 {
249 }
250 }
251
252 public virtual bool IsSecuritySafeCritical
253 {
254 get
255 {
257 }
258 }
259
260 public virtual bool IsSecurityTransparent
261 {
262 get
263 {
265 }
266 }
267
269 {
270 get
271 {
272 throw new NotSupportedException();
273 }
274 }
275
277 {
278 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
279 get
280 {
281 return GetConstructorImpl(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, CallingConventions.Any, EmptyTypes, null);
282 }
283 }
284
286 {
287 get
288 {
289 throw new NotSupportedException();
290 }
291 }
292
293 public abstract Guid GUID { get; }
294
295 public abstract Type? BaseType { get; }
296
297 public static Binder DefaultBinder
298 {
299 get
300 {
301 if (s_defaultBinder == null)
302 {
305 }
306 return s_defaultBinder;
307 }
308 }
309
310 public virtual bool IsSerializable
311 {
312 get
313 {
314 if ((GetAttributeFlagsImpl() & TypeAttributes.Serializable) != 0)
315 {
316 return true;
317 }
319 if (type.IsRuntimeImplemented())
320 {
321 do
322 {
323 if (type == typeof(Delegate) || type == typeof(Enum))
324 {
325 return true;
326 }
328 }
329 while (type != null);
330 }
331 return false;
332 }
333 }
334
335 public virtual bool ContainsGenericParameters
336 {
337 get
338 {
339 if (HasElementType)
340 {
342 }
344 {
345 return true;
346 }
347 if (!IsGenericType)
348 {
349 return false;
350 }
351 Type[] genericArguments = GetGenericArguments();
352 for (int i = 0; i < genericArguments.Length; i++)
353 {
354 if (genericArguments[i].ContainsGenericParameters)
355 {
356 return true;
357 }
358 }
359 return false;
360 }
361 }
362
363 public bool IsVisible
364 {
365 get
366 {
367 if (this is RuntimeType type)
368 {
370 }
372 {
373 return true;
374 }
375 if (HasElementType)
376 {
377 return GetElementType().IsVisible;
378 }
379 Type type2 = this;
380 while (type2.IsNested)
381 {
382 if (!type2.IsNestedPublic)
383 {
384 return false;
385 }
386 type2 = type2.DeclaringType;
387 }
388 if (!type2.IsPublic)
389 {
390 return false;
391 }
393 {
394 Type[] genericArguments = GetGenericArguments();
395 foreach (Type type3 in genericArguments)
396 {
397 if (!type3.IsVisible)
398 {
399 return false;
400 }
401 }
402 }
403 return true;
404 }
405 }
406
407 [RequiresUnreferencedCode("The type might be removed")]
408 public static Type? GetType(string typeName, bool throwOnError, bool ignoreCase)
409 {
410 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
411 return RuntimeType.GetType(typeName, throwOnError, ignoreCase, ref stackMark);
412 }
413
414 [RequiresUnreferencedCode("The type might be removed")]
415 public static Type? GetType(string typeName, bool throwOnError)
416 {
417 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
418 return RuntimeType.GetType(typeName, throwOnError, ignoreCase: false, ref stackMark);
419 }
420
421 [RequiresUnreferencedCode("The type might be removed")]
422 public static Type? GetType(string typeName)
423 {
424 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
425 return RuntimeType.GetType(typeName, throwOnError: false, ignoreCase: false, ref stackMark);
426 }
427
428 [RequiresUnreferencedCode("The type might be removed")]
429 public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver)
430 {
431 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
432 return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError: false, ignoreCase: false, ref stackMark);
433 }
434
435 [RequiresUnreferencedCode("The type might be removed")]
436 public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver, bool throwOnError)
437 {
438 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
439 return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase: false, ref stackMark);
440 }
441
442 [RequiresUnreferencedCode("The type might be removed")]
443 public static Type? GetType(string typeName, Func<AssemblyName, Assembly?>? assemblyResolver, Func<Assembly?, string, bool, Type?>? typeResolver, bool throwOnError, bool ignoreCase)
444 {
445 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
446 return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
447 }
448
450 {
451 return TypeHandle;
452 }
453
454 [MethodImpl(MethodImplOptions.InternalCall)]
456
457 [MethodImpl(MethodImplOptions.InternalCall)]
458 [Intrinsic]
460
461 [MethodImpl(MethodImplOptions.InternalCall)]
462 [Intrinsic]
463 public static extern bool operator ==(Type? left, Type? right);
464
465 [MethodImpl(MethodImplOptions.InternalCall)]
466 [Intrinsic]
467 public static extern bool operator !=(Type? left, Type? right);
468
469 [MethodImpl(MethodImplOptions.AggressiveInlining)]
470 internal bool IsRuntimeImplemented()
471 {
472 return this is RuntimeType;
473 }
474
475 public new Type GetType()
476 {
477 return base.GetType();
478 }
479
480 protected abstract bool IsArrayImpl();
481
482 protected abstract bool IsByRefImpl();
483
484 protected abstract bool IsPointerImpl();
485
486 protected abstract bool HasElementTypeImpl();
487
488 public abstract Type? GetElementType();
489
490 public virtual int GetArrayRank()
491 {
493 }
494
499
500 public virtual Type[] GetGenericArguments()
501 {
503 }
504
506 {
508 {
510 }
511 throw new InvalidOperationException();
512 }
513
515
516 protected abstract bool IsCOMObjectImpl();
517
518 protected virtual bool IsContextfulImpl()
519 {
520 return false;
521 }
522
523 protected virtual bool IsMarshalByRefImpl()
524 {
525 return false;
526 }
527
528 protected abstract bool IsPrimitiveImpl();
529
530 [Intrinsic]
531 public bool IsAssignableTo([NotNullWhen(true)] Type? targetType)
532 {
533 return targetType?.IsAssignableFrom(this) ?? false;
534 }
535
536 protected virtual bool IsValueTypeImpl()
537 {
538 return IsSubclassOf(typeof(ValueType));
539 }
540
541 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
543 {
544 return GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, types, null);
545 }
546
547 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
548 public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Type[] types)
549 {
550 return GetConstructor(bindingAttr, null, types, null);
551 }
552
553 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
554 public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
555 {
556 return GetConstructor(bindingAttr, binder, CallingConventions.Any, types, modifiers);
557 }
558
559 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
560 public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
561 {
562 if (types == null)
563 {
564 throw new ArgumentNullException("types");
565 }
566 for (int i = 0; i < types.Length; i++)
567 {
568 if (types[i] == null)
569 {
570 throw new ArgumentNullException("types");
571 }
572 }
573 return GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers);
574 }
575
576 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
577 protected abstract ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers);
578
579 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
581 {
582 return GetConstructors(BindingFlags.Instance | BindingFlags.Public);
583 }
584
585 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
586 public abstract ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
587
588 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)]
589 public EventInfo? GetEvent(string name)
590 {
591 return GetEvent(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
592 }
593
594 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
595 public abstract EventInfo? GetEvent(string name, BindingFlags bindingAttr);
596
597 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)]
598 public virtual EventInfo[] GetEvents()
599 {
600 return GetEvents(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
601 }
602
603 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
604 public abstract EventInfo[] GetEvents(BindingFlags bindingAttr);
605
606 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)]
607 public FieldInfo? GetField(string name)
608 {
609 return GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
610 }
611
612 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)]
613 public abstract FieldInfo? GetField(string name, BindingFlags bindingAttr);
614
615 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)]
617 {
618 return GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
619 }
620
621 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)]
622 public abstract FieldInfo[] GetFields(BindingFlags bindingAttr);
623
624 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicEvents)]
625 public MemberInfo[] GetMember(string name)
626 {
627 return GetMember(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
628 }
629
630 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
631 public virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr)
632 {
633 return GetMember(name, MemberTypes.All, bindingAttr);
634 }
635
636 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
637 public virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)
638 {
640 }
641
642 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicEvents)]
644 {
645 return GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
646 }
647
648 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "This is finding the MemberInfo with the same MetadataToken as specified MemberInfo. If the specified MemberInfo exists and wasn't trimmed, then the current Type's MemberInfo couldn't have been trimmed.")]
650 {
651 if ((object)member == null)
652 {
653 throw new ArgumentNullException("member");
654 }
655 MemberInfo[] members = GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
656 foreach (MemberInfo memberInfo in members)
657 {
658 if (memberInfo.HasSameMetadataDefinitionAs(member))
659 {
660 return memberInfo;
661 }
662 }
664 }
665
670
671 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
672 public abstract MemberInfo[] GetMembers(BindingFlags bindingAttr);
673
674 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
675 public MethodInfo? GetMethod(string name)
676 {
677 return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
678 }
679
680 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
681 public MethodInfo? GetMethod(string name, BindingFlags bindingAttr)
682 {
683 if (name == null)
684 {
685 throw new ArgumentNullException("name");
686 }
687 return GetMethodImpl(name, bindingAttr, null, CallingConventions.Any, null, null);
688 }
689
690 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
691 public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Type[] types)
692 {
693 return GetMethod(name, bindingAttr, null, types, null);
694 }
695
696 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
697 public MethodInfo? GetMethod(string name, Type[] types)
698 {
699 return GetMethod(name, types, null);
700 }
701
702 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
703 public MethodInfo? GetMethod(string name, Type[] types, ParameterModifier[]? modifiers)
704 {
705 return GetMethod(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, types, modifiers);
706 }
707
708 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
709 public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
710 {
711 return GetMethod(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
712 }
713
714 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
715 public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
716 {
717 if (name == null)
718 {
719 throw new ArgumentNullException("name");
720 }
721 if (types == null)
722 {
723 throw new ArgumentNullException("types");
724 }
725 for (int i = 0; i < types.Length; i++)
726 {
727 if (types[i] == null)
728 {
729 throw new ArgumentNullException("types");
730 }
731 }
732 return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
733 }
734
735 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
736 protected abstract MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers);
737
738 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
739 public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types)
740 {
741 return GetMethod(name, genericParameterCount, types, null);
742 }
743
744 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
745 public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types, ParameterModifier[]? modifiers)
746 {
747 return GetMethod(name, genericParameterCount, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, types, modifiers);
748 }
749
750 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
751 public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
752 {
753 return GetMethod(name, genericParameterCount, bindingAttr, binder, CallingConventions.Any, types, modifiers);
754 }
755
756 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
757 public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
758 {
759 if (name == null)
760 {
761 throw new ArgumentNullException("name");
762 }
763 if (genericParameterCount < 0)
764 {
765 throw new ArgumentException(SR.ArgumentOutOfRange_NeedNonNegNum, "genericParameterCount");
766 }
767 if (types == null)
768 {
769 throw new ArgumentNullException("types");
770 }
771 for (int i = 0; i < types.Length; i++)
772 {
773 if (types[i] == null)
774 {
775 throw new ArgumentNullException("types");
776 }
777 }
778 return GetMethodImpl(name, genericParameterCount, bindingAttr, binder, callConvention, types, modifiers);
779 }
780
781 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
782 protected virtual MethodInfo? GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
783 {
784 throw new NotSupportedException();
785 }
786
787 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
789 {
790 return GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
791 }
792
793 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
794 public abstract MethodInfo[] GetMethods(BindingFlags bindingAttr);
795
796 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes)]
797 public Type? GetNestedType(string name)
798 {
799 return GetNestedType(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
800 }
801
802 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)]
803 public abstract Type? GetNestedType(string name, BindingFlags bindingAttr);
804
805 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes)]
807 {
808 return GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
809 }
810
811 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)]
812 public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
813
814 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
815 public PropertyInfo? GetProperty(string name)
816 {
817 return GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
818 }
819
820 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
821 public PropertyInfo? GetProperty(string name, BindingFlags bindingAttr)
822 {
823 if (name == null)
824 {
825 throw new ArgumentNullException("name");
826 }
827 return GetPropertyImpl(name, bindingAttr, null, null, null, null);
828 }
829
830 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
831 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "Linker doesn't recognize GetPropertyImpl(BindingFlags.Public) but this is what the body is doing")]
832 public PropertyInfo? GetProperty(string name, Type? returnType)
833 {
834 if (name == null)
835 {
836 throw new ArgumentNullException("name");
837 }
838 return GetPropertyImpl(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, returnType, null, null);
839 }
840
841 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
842 public PropertyInfo? GetProperty(string name, Type[] types)
843 {
844 return GetProperty(name, null, types);
845 }
846
847 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
848 public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types)
849 {
850 return GetProperty(name, returnType, types, null);
851 }
852
853 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
854 public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
855 {
856 return GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, returnType, types, modifiers);
857 }
858
859 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
860 public PropertyInfo? GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
861 {
862 if (name == null)
863 {
864 throw new ArgumentNullException("name");
865 }
866 if (types == null)
867 {
868 throw new ArgumentNullException("types");
869 }
870 return GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers);
871 }
872
873 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
874 protected abstract PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers);
875
876 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
878 {
879 return GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
880 }
881
882 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
883 public abstract PropertyInfo[] GetProperties(BindingFlags bindingAttr);
884
885 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicEvents)]
886 public virtual MemberInfo[] GetDefaultMembers()
887 {
889 }
890
891 public static RuntimeTypeHandle GetTypeHandle(object o)
892 {
893 if (o == null)
894 {
896 }
897 Type type = o.GetType();
898 return type.TypeHandle;
899 }
900
901 public static Type[] GetTypeArray(object[] args)
902 {
903 if (args == null)
904 {
905 throw new ArgumentNullException("args");
906 }
907 Type[] array = new Type[args.Length];
908 for (int i = 0; i < array.Length; i++)
909 {
910 if (args[i] == null)
911 {
913 }
914 array[i] = args[i].GetType();
915 }
916 return array;
917 }
918
920 {
921 return type?.GetTypeCodeImpl() ?? TypeCode.Empty;
922 }
923
924 protected virtual TypeCode GetTypeCodeImpl()
925 {
926 Type underlyingSystemType = UnderlyingSystemType;
927 if ((object)this != underlyingSystemType && (object)underlyingSystemType != null)
928 {
929 return GetTypeCode(underlyingSystemType);
930 }
931 return TypeCode.Object;
932 }
933
934 [SupportedOSPlatform("windows")]
935 public static Type? GetTypeFromCLSID(Guid clsid)
936 {
937 return GetTypeFromCLSID(clsid, null, throwOnError: false);
938 }
939
940 [SupportedOSPlatform("windows")]
941 public static Type? GetTypeFromCLSID(Guid clsid, bool throwOnError)
942 {
943 return GetTypeFromCLSID(clsid, null, throwOnError);
944 }
945
946 [SupportedOSPlatform("windows")]
947 public static Type? GetTypeFromCLSID(Guid clsid, string? server)
948 {
949 return GetTypeFromCLSID(clsid, server, throwOnError: false);
950 }
951
952 [SupportedOSPlatform("windows")]
953 public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
954 {
955 return Marshal.GetTypeFromCLSID(clsid, server, throwOnError);
956 }
957
958 [SupportedOSPlatform("windows")]
959 public static Type? GetTypeFromProgID(string progID)
960 {
961 return GetTypeFromProgID(progID, null, throwOnError: false);
962 }
963
964 [SupportedOSPlatform("windows")]
965 public static Type? GetTypeFromProgID(string progID, bool throwOnError)
966 {
967 return GetTypeFromProgID(progID, null, throwOnError);
968 }
969
970 [SupportedOSPlatform("windows")]
971 public static Type? GetTypeFromProgID(string progID, string? server)
972 {
973 return GetTypeFromProgID(progID, server, throwOnError: false);
974 }
975
976 [SupportedOSPlatform("windows")]
977 public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError)
978 {
979 return Marshal.GetTypeFromProgID(progID, server, throwOnError);
980 }
981
982 [DebuggerHidden]
983 [DebuggerStepThrough]
984 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
985 public object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args)
986 {
987 return InvokeMember(name, invokeAttr, binder, target, args, null, null, null);
988 }
989
990 [DebuggerHidden]
991 [DebuggerStepThrough]
992 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
993 public object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, CultureInfo? culture)
994 {
995 return InvokeMember(name, invokeAttr, binder, target, args, null, culture, null);
996 }
997
998 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
999 public abstract object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters);
1000
1001 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1002 [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1003 public Type? GetInterface(string name)
1004 {
1005 return GetInterface(name, ignoreCase: false);
1006 }
1007
1008 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1009 [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1010 public abstract Type? GetInterface(string name, bool ignoreCase);
1011
1012 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1013 public abstract Type[] GetInterfaces();
1014
1015 public virtual InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
1016 {
1018 }
1019
1020 public virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
1021 {
1022 if (o != null)
1023 {
1024 return IsAssignableFrom(o.GetType());
1025 }
1026 return false;
1027 }
1028
1029 public virtual bool IsEquivalentTo([NotNullWhen(true)] Type? other)
1030 {
1031 return this == other;
1032 }
1033
1034 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "The single instance field on enum types is never trimmed")]
1036 {
1037 if (!IsEnum)
1038 {
1039 throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
1040 }
1041 FieldInfo[] fields = GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
1042 if (fields == null || fields.Length != 1)
1043 {
1044 throw new ArgumentException(SR.Argument_InvalidEnum, "enumType");
1045 }
1046 return fields[0].FieldType;
1047 }
1048
1049 public virtual Array GetEnumValues()
1050 {
1051 if (!IsEnum)
1052 {
1053 throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
1054 }
1056 }
1057
1058 public virtual Type MakeArrayType()
1059 {
1060 throw new NotSupportedException();
1061 }
1062
1063 public virtual Type MakeArrayType(int rank)
1064 {
1065 throw new NotSupportedException();
1066 }
1067
1068 public virtual Type MakeByRefType()
1069 {
1070 throw new NotSupportedException();
1071 }
1072
1073 [RequiresUnreferencedCode("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
1074 public virtual Type MakeGenericType(params Type[] typeArguments)
1075 {
1077 }
1078
1079 public virtual Type MakePointerType()
1080 {
1081 throw new NotSupportedException();
1082 }
1083
1084 public static Type MakeGenericSignatureType(Type genericTypeDefinition, params Type[] typeArguments)
1085 {
1086 return new SignatureConstructedGenericType(genericTypeDefinition, typeArguments);
1087 }
1088
1089 public static Type MakeGenericMethodParameter(int position)
1090 {
1091 if (position < 0)
1092 {
1094 }
1095 return new SignatureGenericMethodParameterType(position);
1096 }
1097
1098 internal string FormatTypeName()
1099 {
1100 Type rootElementType = GetRootElementType();
1101 if (rootElementType.IsPrimitive || rootElementType.IsNested || rootElementType == typeof(void) || rootElementType == typeof(TypedReference))
1102 {
1103 return Name;
1104 }
1105 return ToString();
1106 }
1107
1108 public override string ToString()
1109 {
1110 return "Type: " + Name;
1111 }
1112
1113 public override bool Equals(object? o)
1114 {
1115 if (o != null)
1116 {
1117 return Equals(o as Type);
1118 }
1119 return false;
1120 }
1121
1122 public override int GetHashCode()
1123 {
1124 Type underlyingSystemType = UnderlyingSystemType;
1125 if ((object)underlyingSystemType != this)
1126 {
1127 return underlyingSystemType.GetHashCode();
1128 }
1129 return base.GetHashCode();
1130 }
1131
1132 public virtual bool Equals(Type? o)
1133 {
1134 if (!(o == null))
1135 {
1136 return (object)UnderlyingSystemType == o.UnderlyingSystemType;
1137 }
1138 return false;
1139 }
1140
1141 [Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
1142 public static Type? ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase)
1143 {
1145 }
1146
1147 public virtual bool IsEnumDefined(object value)
1148 {
1149 if (value == null)
1150 {
1151 throw new ArgumentNullException("value");
1152 }
1153 if (!IsEnum)
1154 {
1155 throw new ArgumentException(SR.Arg_MustBeEnum, "value");
1156 }
1157 Type type = value.GetType();
1158 if (type.IsEnum)
1159 {
1160 if (!type.IsEquivalentTo(this))
1161 {
1163 }
1164 type = type.GetEnumUnderlyingType();
1165 }
1166 if (type == typeof(string))
1167 {
1168 string[] enumNames = GetEnumNames();
1169 object[] array = enumNames;
1170 if (Array.IndexOf(array, value) >= 0)
1171 {
1172 return true;
1173 }
1174 return false;
1175 }
1176 if (IsIntegerType(type))
1177 {
1178 Type enumUnderlyingType = GetEnumUnderlyingType();
1179 if (enumUnderlyingType.GetTypeCodeImpl() != type.GetTypeCodeImpl())
1180 {
1182 }
1183 Array enumRawConstantValues = GetEnumRawConstantValues();
1184 return BinarySearch(enumRawConstantValues, value) >= 0;
1185 }
1187 }
1188
1189 public virtual string? GetEnumName(object value)
1190 {
1191 if (value == null)
1192 {
1193 throw new ArgumentNullException("value");
1194 }
1195 if (!IsEnum)
1196 {
1197 throw new ArgumentException(SR.Arg_MustBeEnum, "value");
1198 }
1199 Type type = value.GetType();
1200 if (!type.IsEnum && !IsIntegerType(type))
1201 {
1203 }
1204 Array enumRawConstantValues = GetEnumRawConstantValues();
1205 int num = BinarySearch(enumRawConstantValues, value);
1206 if (num >= 0)
1207 {
1208 string[] enumNames = GetEnumNames();
1209 return enumNames[num];
1210 }
1211 return null;
1212 }
1213
1214 public virtual string[] GetEnumNames()
1215 {
1216 if (!IsEnum)
1217 {
1218 throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
1219 }
1220 GetEnumData(out var enumNames, out var _);
1221 return enumNames;
1222 }
1223
1225 {
1226 GetEnumData(out var _, out var enumValues);
1227 return enumValues;
1228 }
1229
1230 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "Literal fields on enums can never be trimmed")]
1231 private void GetEnumData(out string[] enumNames, out Array enumValues)
1232 {
1233 FieldInfo[] fields = GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
1234 object[] array = new object[fields.Length];
1235 string[] array2 = new string[fields.Length];
1236 for (int i = 0; i < fields.Length; i++)
1237 {
1238 array2[i] = fields[i].Name;
1239 array[i] = fields[i].GetRawConstantValue();
1240 }
1241 Comparer @default = Comparer.Default;
1242 for (int j = 1; j < array.Length; j++)
1243 {
1244 int num = j;
1245 string text = array2[j];
1246 object obj = array[j];
1247 bool flag = false;
1248 while (@default.Compare(array[num - 1], obj) > 0)
1249 {
1250 array2[num] = array2[num - 1];
1251 array[num] = array[num - 1];
1252 num--;
1253 flag = true;
1254 if (num == 0)
1255 {
1256 break;
1257 }
1258 }
1259 if (flag)
1260 {
1261 array2[num] = text;
1262 array[num] = obj;
1263 }
1264 }
1265 enumNames = array2;
1266 enumValues = array;
1267 }
1268
1269 private static int BinarySearch(Array array, object value)
1270 {
1271 ulong[] array2 = new ulong[array.Length];
1272 for (int i = 0; i < array.Length; i++)
1273 {
1274 array2[i] = Enum.ToUInt64(array.GetValue(i));
1275 }
1276 ulong value2 = Enum.ToUInt64(value);
1277 return Array.BinarySearch(array2, value2);
1278 }
1279
1280 internal static bool IsIntegerType(Type t)
1281 {
1282 if (!(t == typeof(int)) && !(t == typeof(short)) && !(t == typeof(ushort)) && !(t == typeof(byte)) && !(t == typeof(sbyte)) && !(t == typeof(uint)) && !(t == typeof(long)) && !(t == typeof(ulong)) && !(t == typeof(char)))
1283 {
1284 return t == typeof(bool);
1285 }
1286 return true;
1287 }
1288
1290 {
1291 Type type = this;
1292 while (type.HasElementType)
1293 {
1295 }
1296 return type;
1297 }
1298
1299 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
1300 public virtual Type[] FindInterfaces(TypeFilter filter, object? filterCriteria)
1301 {
1302 if (filter == null)
1303 {
1304 throw new ArgumentNullException("filter");
1305 }
1306 Type[] interfaces = GetInterfaces();
1307 int num = 0;
1308 for (int i = 0; i < interfaces.Length; i++)
1309 {
1310 if (!filter(interfaces[i], filterCriteria))
1311 {
1312 interfaces[i] = null;
1313 }
1314 else
1315 {
1316 num++;
1317 }
1318 }
1319 if (num == interfaces.Length)
1320 {
1321 return interfaces;
1322 }
1323 Type[] array = new Type[num];
1324 num = 0;
1325 foreach (Type type in interfaces)
1326 {
1327 if ((object)type != null)
1328 {
1329 array[num++] = type;
1330 }
1331 }
1332 return array;
1333 }
1334
1335 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
1336 public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter? filter, object? filterCriteria)
1337 {
1338 MethodInfo[] array = null;
1339 ConstructorInfo[] array2 = null;
1340 FieldInfo[] array3 = null;
1341 PropertyInfo[] array4 = null;
1342 EventInfo[] array5 = null;
1343 Type[] array6 = null;
1344 int num = 0;
1345 if ((memberType & MemberTypes.Method) != 0)
1346 {
1347 array = GetMethods(bindingAttr);
1348 if (filter != null)
1349 {
1350 for (int i = 0; i < array.Length; i++)
1351 {
1352 if (!filter(array[i], filterCriteria))
1353 {
1354 array[i] = null;
1355 }
1356 else
1357 {
1358 num++;
1359 }
1360 }
1361 }
1362 else
1363 {
1364 num += array.Length;
1365 }
1366 }
1367 if ((memberType & MemberTypes.Constructor) != 0)
1368 {
1369 array2 = GetConstructors(bindingAttr);
1370 if (filter != null)
1371 {
1372 for (int i = 0; i < array2.Length; i++)
1373 {
1374 if (!filter(array2[i], filterCriteria))
1375 {
1376 array2[i] = null;
1377 }
1378 else
1379 {
1380 num++;
1381 }
1382 }
1383 }
1384 else
1385 {
1386 num += array2.Length;
1387 }
1388 }
1389 if ((memberType & MemberTypes.Field) != 0)
1390 {
1391 array3 = GetFields(bindingAttr);
1392 if (filter != null)
1393 {
1394 for (int i = 0; i < array3.Length; i++)
1395 {
1396 if (!filter(array3[i], filterCriteria))
1397 {
1398 array3[i] = null;
1399 }
1400 else
1401 {
1402 num++;
1403 }
1404 }
1405 }
1406 else
1407 {
1408 num += array3.Length;
1409 }
1410 }
1411 if ((memberType & MemberTypes.Property) != 0)
1412 {
1413 array4 = GetProperties(bindingAttr);
1414 if (filter != null)
1415 {
1416 for (int i = 0; i < array4.Length; i++)
1417 {
1418 if (!filter(array4[i], filterCriteria))
1419 {
1420 array4[i] = null;
1421 }
1422 else
1423 {
1424 num++;
1425 }
1426 }
1427 }
1428 else
1429 {
1430 num += array4.Length;
1431 }
1432 }
1433 if ((memberType & MemberTypes.Event) != 0)
1434 {
1435 array5 = GetEvents(bindingAttr);
1436 if (filter != null)
1437 {
1438 for (int i = 0; i < array5.Length; i++)
1439 {
1440 if (!filter(array5[i], filterCriteria))
1441 {
1442 array5[i] = null;
1443 }
1444 else
1445 {
1446 num++;
1447 }
1448 }
1449 }
1450 else
1451 {
1452 num += array5.Length;
1453 }
1454 }
1455 if ((memberType & MemberTypes.NestedType) != 0)
1456 {
1457 array6 = GetNestedTypes(bindingAttr);
1458 if (filter != null)
1459 {
1460 for (int i = 0; i < array6.Length; i++)
1461 {
1462 if (!filter(array6[i], filterCriteria))
1463 {
1464 array6[i] = null;
1465 }
1466 else
1467 {
1468 num++;
1469 }
1470 }
1471 }
1472 else
1473 {
1474 num += array6.Length;
1475 }
1476 }
1477 MemberInfo[] array7 = new MemberInfo[num];
1478 num = 0;
1479 if (array != null)
1480 {
1481 for (int i = 0; i < array.Length; i++)
1482 {
1483 if (array[i] != null)
1484 {
1485 array7[num++] = array[i];
1486 }
1487 }
1488 }
1489 if (array2 != null)
1490 {
1491 foreach (ConstructorInfo constructorInfo in array2)
1492 {
1493 if ((object)constructorInfo != null)
1494 {
1495 array7[num++] = constructorInfo;
1496 }
1497 }
1498 }
1499 if (array3 != null)
1500 {
1501 foreach (FieldInfo fieldInfo in array3)
1502 {
1503 if ((object)fieldInfo != null)
1504 {
1505 array7[num++] = fieldInfo;
1506 }
1507 }
1508 }
1509 if (array4 != null)
1510 {
1511 foreach (PropertyInfo propertyInfo in array4)
1512 {
1513 if ((object)propertyInfo != null)
1514 {
1515 array7[num++] = propertyInfo;
1516 }
1517 }
1518 }
1519 if (array5 != null)
1520 {
1521 foreach (EventInfo eventInfo in array5)
1522 {
1523 if ((object)eventInfo != null)
1524 {
1525 array7[num++] = eventInfo;
1526 }
1527 }
1528 }
1529 if (array6 != null)
1530 {
1531 foreach (Type type in array6)
1532 {
1533 if ((object)type != null)
1534 {
1535 array7[num++] = type;
1536 }
1537 }
1538 }
1539 return array7;
1540 }
1541
1542 public virtual bool IsSubclassOf(Type c)
1543 {
1544 Type type = this;
1545 if (type == c)
1546 {
1547 return false;
1548 }
1549 while (type != null)
1550 {
1551 if (type == c)
1552 {
1553 return true;
1554 }
1555 type = type.BaseType;
1556 }
1557 return false;
1558 }
1559
1560 [Intrinsic]
1561 public virtual bool IsAssignableFrom([NotNullWhen(true)] Type? c)
1562 {
1563 if (c == null)
1564 {
1565 return false;
1566 }
1567 if (this == c)
1568 {
1569 return true;
1570 }
1571 Type underlyingSystemType = UnderlyingSystemType;
1572 if ((object)underlyingSystemType != null && underlyingSystemType.IsRuntimeImplemented())
1573 {
1574 return underlyingSystemType.IsAssignableFrom(c);
1575 }
1576 if (c.IsSubclassOf(this))
1577 {
1578 return true;
1579 }
1580 if (IsInterface)
1581 {
1582 return c.ImplementInterface(this);
1583 }
1585 {
1586 Type[] genericParameterConstraints = GetGenericParameterConstraints();
1587 for (int i = 0; i < genericParameterConstraints.Length; i++)
1588 {
1589 if (!genericParameterConstraints[i].IsAssignableFrom(c))
1590 {
1591 return false;
1592 }
1593 }
1594 return true;
1595 }
1596 return false;
1597 }
1598
1599 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "The GetInterfaces technically requires all interfaces to be preservedBut this method only compares the result against the passed in ifaceType.So if ifaceType exists, then trimming should have kept it implemented on any type.")]
1600 internal bool ImplementInterface(Type ifaceType)
1601 {
1602 Type type = this;
1603 while (type != null)
1604 {
1605 Type[] interfaces = type.GetInterfaces();
1606 if (interfaces != null)
1607 {
1608 for (int i = 0; i < interfaces.Length; i++)
1609 {
1610 if (interfaces[i] == ifaceType || (interfaces[i] != null && interfaces[i].ImplementInterface(ifaceType)))
1611 {
1612 return true;
1613 }
1614 }
1615 }
1616 type = type.BaseType;
1617 }
1618 return false;
1619 }
1620
1621 private static bool FilterAttributeImpl(MemberInfo m, object filterCriteria)
1622 {
1623 if (filterCriteria == null)
1624 {
1626 }
1627 switch (m.MemberType)
1628 {
1629 case MemberTypes.Constructor:
1630 case MemberTypes.Method:
1631 {
1632 MethodAttributes methodAttributes;
1633 try
1634 {
1635 int num2 = (int)filterCriteria;
1636 methodAttributes = (MethodAttributes)num2;
1637 }
1638 catch
1639 {
1641 }
1642 MethodAttributes methodAttributes2 = ((m.MemberType != MemberTypes.Method) ? ((ConstructorInfo)m).Attributes : ((MethodInfo)m).Attributes);
1643 if ((methodAttributes & MethodAttributes.MemberAccessMask) != 0 && (methodAttributes2 & MethodAttributes.MemberAccessMask) != (methodAttributes & MethodAttributes.MemberAccessMask))
1644 {
1645 return false;
1646 }
1647 if ((methodAttributes & MethodAttributes.Static) != 0 && (methodAttributes2 & MethodAttributes.Static) == 0)
1648 {
1649 return false;
1650 }
1651 if ((methodAttributes & MethodAttributes.Final) != 0 && (methodAttributes2 & MethodAttributes.Final) == 0)
1652 {
1653 return false;
1654 }
1655 if ((methodAttributes & MethodAttributes.Virtual) != 0 && (methodAttributes2 & MethodAttributes.Virtual) == 0)
1656 {
1657 return false;
1658 }
1659 if ((methodAttributes & MethodAttributes.Abstract) != 0 && (methodAttributes2 & MethodAttributes.Abstract) == 0)
1660 {
1661 return false;
1662 }
1663 if ((methodAttributes & MethodAttributes.SpecialName) != 0 && (methodAttributes2 & MethodAttributes.SpecialName) == 0)
1664 {
1665 return false;
1666 }
1667 return true;
1668 }
1669 case MemberTypes.Field:
1670 {
1671 FieldAttributes fieldAttributes;
1672 try
1673 {
1674 int num = (int)filterCriteria;
1675 fieldAttributes = (FieldAttributes)num;
1676 }
1677 catch
1678 {
1680 }
1681 FieldAttributes attributes = ((FieldInfo)m).Attributes;
1682 if ((fieldAttributes & FieldAttributes.FieldAccessMask) != 0 && (attributes & FieldAttributes.FieldAccessMask) != (fieldAttributes & FieldAttributes.FieldAccessMask))
1683 {
1684 return false;
1685 }
1686 if ((fieldAttributes & FieldAttributes.Static) != 0 && (attributes & FieldAttributes.Static) == 0)
1687 {
1688 return false;
1689 }
1690 if ((fieldAttributes & FieldAttributes.InitOnly) != 0 && (attributes & FieldAttributes.InitOnly) == 0)
1691 {
1692 return false;
1693 }
1694 if ((fieldAttributes & FieldAttributes.Literal) != 0 && (attributes & FieldAttributes.Literal) == 0)
1695 {
1696 return false;
1697 }
1698 if ((fieldAttributes & FieldAttributes.NotSerialized) != 0 && (attributes & FieldAttributes.NotSerialized) == 0)
1699 {
1700 return false;
1701 }
1702 if ((fieldAttributes & FieldAttributes.PinvokeImpl) != 0 && (attributes & FieldAttributes.PinvokeImpl) == 0)
1703 {
1704 return false;
1705 }
1706 return true;
1707 }
1708 default:
1709 return false;
1710 }
1711 }
1712
1713 private static bool FilterNameImpl(MemberInfo m, object filterCriteria, StringComparison comparison)
1714 {
1715 if (!(filterCriteria is string text))
1716 {
1718 }
1719 ReadOnlySpan<char> readOnlySpan = text.AsSpan().Trim();
1720 ReadOnlySpan<char> span = m.Name;
1721 if (m.MemberType == MemberTypes.NestedType)
1722 {
1723 span = span.Slice(span.LastIndexOf('+') + 1);
1724 }
1725 if (readOnlySpan.Length > 0 && readOnlySpan[readOnlySpan.Length - 1] == '*')
1726 {
1727 readOnlySpan = readOnlySpan.Slice(0, readOnlySpan.Length - 1);
1728 return span.StartsWith(readOnlySpan, comparison);
1729 }
1730 return MemoryExtensions.Equals(span, readOnlySpan, comparison);
1731 }
1732}
int IList. IndexOf(object value)
Definition Array.cs:1228
static int BinarySearch(Array array, object? value)
Definition Array.cs:1320
static readonly Comparer Default
Definition Comparer.cs:13
static ulong ToUInt64(object value)
Definition Enum.cs:240
static bool Equals(this ReadOnlySpan< char > span, ReadOnlySpan< char > other, StringComparison comparisonType)
static Exception ByDesign
virtual ? object GetRawConstantValue()
Definition FieldInfo.cs:127
virtual bool HasSameMetadataDefinitionAs(MemberInfo other)
Definition MemberInfo.cs:66
static readonly Missing Value
Definition Missing.cs:7
static RuntimeType GetType(string typeName, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark)
static Type GetTypeFromProgID(string progID, string server, bool throwOnError)
Definition Marshal.cs:1758
static Type GetTypeFromCLSID(Guid clsid, string server, bool throwOnError)
Definition Marshal.cs:216
static string Arg_MustBeEnum
Definition SR.cs:274
static string Arg_InvalidHandle
Definition SR.cs:14
static string Arg_EnumAndObjectMustBeSameType
Definition SR.cs:140
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Arg_MemberInfoNotFound
Definition SR.cs:2210
static string PlatformNotSupported_ReflectionOnly
Definition SR.cs:1792
static string Arg_NotGenericParameter
Definition SR.cs:346
static string InvalidOperation_UnknownEnumType
Definition SR.cs:1530
static string InvalidFilterCriteriaException_CritString
Definition SR.cs:1840
static string ArgumentNull_ArrayValue
Definition SR.cs:934
static string Argument_InvalidEnum
Definition SR.cs:680
static string ArgumentOutOfRange_NeedNonNegNum
Definition SR.cs:32
static string InvalidFilterCriteriaException_CritInt
Definition SR.cs:1838
static string Arg_EnumUnderlyingTypeAndObjectMustBeSameType
Definition SR.cs:148
static string Arg_MustBeEnumBaseTypeOrEnum
Definition SR.cs:276
static string NotSupported_SubclassOverride
Definition SR.cs:1714
Definition SR.cs:7
static int CompareExchange(ref int location1, int value, int comparand)
static Type GetType(string typeName, Func< AssemblyName, Assembly > assemblyResolver, Func< Assembly, string, bool, Type > typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark)
Type? GetElementType()
bool IsLayoutSequential
Definition Type.cs:215
bool IsInterface
Definition Type.cs:30
virtual bool IsAssignableFrom([NotNullWhen(true)] Type? c)
Definition Type.cs:1561
bool IsValueType
Definition Type.cs:234
virtual ? MethodBase DeclaringMethod
Definition Type.cs:57
EventInfo[] GetEvents(BindingFlags bindingAttr)
FieldInfo[] GetFields(BindingFlags bindingAttr)
bool IsClass
Definition Type.cs:184
static RuntimeTypeHandle GetTypeHandle(object o)
Definition Type.cs:891
TypeAttributes Attributes
Definition Type.cs:173
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
virtual ? string GetEnumName(object value)
Definition Type.cs:1189
bool IsPointer
Definition Type.cs:75
Array GetEnumRawConstantValues()
Definition Type.cs:1224
PropertyInfo? GetProperty(string name, BindingFlags bindingAttr)
Definition Type.cs:821
virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr)
Definition Type.cs:631
bool IsPublic
Definition Type.cs:209
virtual Type[] GetGenericParameterConstraints()
Definition Type.cs:505
bool IsNestedFamily
Definition Type.cs:199
bool IsMarshalByRef
Definition Type.cs:229
virtual Type[] GenericTypeArguments
Definition Type.cs:146
virtual Type[] FindInterfaces(TypeFilter filter, object? filterCriteria)
Definition Type.cs:1300
bool IsNested
Definition Type.cs:53
virtual RuntimeTypeHandle GetTypeHandleInternal()
Definition Type.cs:449
void GetEnumData(out string[] enumNames, out Array enumValues)
Definition Type.cs:1231
Type UnderlyingSystemType
Definition Type.cs:61
EventInfo? GetEvent(string name)
Definition Type.cs:589
static readonly char Delimiter
Definition Type.cs:17
static ? Type ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase)
Definition Type.cs:1142
virtual Type[] GetGenericArguments()
Definition Type.cs:500
Type? GetNestedType(string name, BindingFlags bindingAttr)
virtual bool IsMarshalByRefImpl()
Definition Type.cs:523
PropertyInfo? GetProperty(string name)
Definition Type.cs:815
virtual bool IsSecurityCritical
Definition Type.cs:245
virtual bool IsGenericParameter
Definition Type.cs:85
PropertyInfo? GetProperty(string name, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:854
static volatile Binder s_defaultBinder
Definition Type.cs:15
virtual Type MakeGenericType(params Type[] typeArguments)
Definition Type.cs:1074
bool IsSpecialName
Definition Type.cs:181
virtual bool IsSecuritySafeCritical
Definition Type.cs:253
Type? GetInterface(string name)
Definition Type.cs:1003
virtual bool IsSerializable
Definition Type.cs:311
virtual bool IsGenericTypeParameter
Definition Type.cs:88
bool IsAutoLayout
Definition Type.cs:211
object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters)
ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
bool HasElementTypeImpl()
bool IsNotPublic
Definition Type.cs:207
bool IsCOMObject
Definition Type.cs:223
FieldInfo? GetField(string name)
Definition Type.cs:607
static bool operator==(Type? left, Type? right)
bool IsAutoClass
Definition Type.cs:219
ConstructorInfo? TypeInitializer
Definition Type.cs:277
virtual bool IsConstructedGenericType
Definition Type.cs:78
bool IsByRefImpl()
MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
bool IsArray
Definition Type.cs:71
static readonly MemberFilter FilterAttribute
Definition Type.cs:23
MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:709
FieldInfo? GetField(string name, BindingFlags bindingAttr)
override MemberTypes MemberType
Definition Type.cs:41
virtual MemberInfo GetMemberWithSameMetadataDefinitionAs(MemberInfo member)
Definition Type.cs:649
static ? Type GetTypeFromProgID(string progID, string? server)
Definition Type.cs:971
virtual string[] GetEnumNames()
Definition Type.cs:1214
static bool FilterNameImpl(MemberInfo m, object filterCriteria, StringComparison comparison)
Definition Type.cs:1713
virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter? filter, object? filterCriteria)
Definition Type.cs:1336
ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
virtual int GenericParameterPosition
Definition Type.cs:158
PropertyInfo[] GetProperties(BindingFlags bindingAttr)
bool IsPointerImpl()
virtual bool IsEnum
Definition Type.cs:227
virtual bool IsVariableBoundArray
Definition Type.cs:124
static bool FilterAttributeImpl(MemberInfo m, object filterCriteria)
Definition Type.cs:1621
override bool Equals(object? o)
Definition Type.cs:1113
static ? Type GetTypeFromCLSID(Guid clsid, string? server)
Definition Type.cs:947
virtual int GetArrayRank()
Definition Type.cs:490
bool IsNestedFamORAssem
Definition Type.cs:201
string FormatTypeName()
Definition Type.cs:1098
bool IsNestedPrivate
Definition Type.cs:203
MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types)
Definition Type.cs:739
virtual MemberInfo[] GetDefaultMembers()
Definition Type.cs:886
virtual bool IsSecurityTransparent
Definition Type.cs:261
FieldInfo[] GetFields()
Definition Type.cs:616
virtual bool IsEnumDefined(object value)
Definition Type.cs:1147
static Binder DefaultBinder
Definition Type.cs:298
object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args)
Definition Type.cs:985
static TypeCode GetTypeCode(Type? type)
Definition Type.cs:919
bool IsExplicitLayout
Definition Type.cs:213
MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Type[] types)
Definition Type.cs:691
virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
Definition Type.cs:1020
bool IsAnsiClass
Definition Type.cs:217
static ? Type GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
Definition Type.cs:953
override int GetHashCode()
Definition Type.cs:1122
static ? Type GetType(string typeName, bool throwOnError)
Definition Type.cs:415
ConstructorInfo? GetConstructor(Type[] types)
Definition Type.cs:542
static ? Type GetTypeFromProgID(string progID, string? server, bool throwOnError)
Definition Type.cs:977
static RuntimeType GetTypeFromHandleUnsafe(IntPtr handle)
Type[] GetNestedTypes(BindingFlags bindingAttr)
ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:554
PropertyInfo? GetProperty(string name, Type[] types)
Definition Type.cs:842
static Type MakeGenericSignatureType(Type genericTypeDefinition, params Type[] typeArguments)
Definition Type.cs:1084
PropertyInfo[] GetProperties()
Definition Type.cs:877
bool IsAssignableTo([NotNullWhen(true)] Type? targetType)
Definition Type.cs:531
Type[] GetNestedTypes()
Definition Type.cs:806
MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:715
static Type GetTypeFromHandle(RuntimeTypeHandle handle)
PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
string? Namespace
Definition Type.cs:43
MemberInfo[] GetMembers(BindingFlags bindingAttr)
virtual bool IsSignatureType
Definition Type.cs:242
static ? Type GetTypeFromProgID(string progID)
Definition Type.cs:959
bool IsPrimitive
Definition Type.cs:231
virtual bool IsGenericType
Definition Type.cs:111
bool IsNestedFamANDAssem
Definition Type.cs:197
virtual Type GetEnumUnderlyingType()
Definition Type.cs:1035
MethodInfo? GetMethod(string name, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:703
virtual bool IsGenericMethodParameter
Definition Type.cs:100
ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Type[] types)
Definition Type.cs:548
static int BinarySearch(Array array, object value)
Definition Type.cs:1269
static ? Type GetTypeFromCLSID(Guid clsid, bool throwOnError)
Definition Type.cs:941
Type? GetInterface(string name, bool ignoreCase)
static ? Type GetType(string typeName)
Definition Type.cs:422
bool ImplementInterface(Type ifaceType)
Definition Type.cs:1600
virtual bool IsContextfulImpl()
Definition Type.cs:518
MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:757
PropertyInfo? GetProperty(string name, Type? returnType, Type[] types)
Definition Type.cs:848
virtual bool IsSZArray
Definition Type.cs:116
ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:560
PropertyInfo? GetProperty(string name, Type? returnType)
Definition Type.cs:832
static ? Type GetTypeFromProgID(string progID, bool throwOnError)
Definition Type.cs:965
PropertyInfo? GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:860
static ? Type GetType(string typeName, Func< AssemblyName, Assembly?>? assemblyResolver, Func< Assembly?, string, bool, Type?>? typeResolver, bool throwOnError)
Definition Type.cs:436
static readonly MemberFilter FilterNameIgnoreCase
Definition Type.cs:27
virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr)
Definition Type.cs:637
virtual bool Equals(Type? o)
Definition Type.cs:1132
override? Type DeclaringType
Definition Type.cs:55
static bool IsIntegerType(Type t)
Definition Type.cs:1280
static Type[] GetTypeArray(object[] args)
Definition Type.cs:901
virtual bool IsTypeDefinition
Definition Type.cs:64
Type? GetNestedType(string name)
Definition Type.cs:797
bool IsUnicodeClass
Definition Type.cs:221
virtual bool IsEquivalentTo([NotNullWhen(true)] Type? other)
Definition Type.cs:1029
new Type GetType()
Definition Type.cs:475
bool IsVisible
Definition Type.cs:364
virtual Type MakeArrayType(int rank)
Definition Type.cs:1063
bool HasElementType
Definition Type.cs:143
bool IsRuntimeImplemented()
Definition Type.cs:470
virtual bool IsSubclassOf(Type c)
Definition Type.cs:1542
virtual bool IsByRefLike
Definition Type.cs:136
virtual ? MethodInfo GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
Definition Type.cs:782
bool IsPrimitiveImpl()
bool IsImport
Definition Type.cs:177
static ? Type GetType(string typeName, Func< AssemblyName, Assembly?>? assemblyResolver, Func< Assembly?, string, bool, Type?>? typeResolver, bool throwOnError, bool ignoreCase)
Definition Type.cs:443
virtual Array GetEnumValues()
Definition Type.cs:1049
MethodInfo? GetMethod(string name, BindingFlags bindingAttr)
Definition Type.cs:681
Type GetRootElementType()
Definition Type.cs:1289
bool IsNestedAssembly
Definition Type.cs:195
TypeAttributes GetAttributeFlagsImpl()
Type? BaseType
Definition Type.cs:295
virtual Type MakeArrayType()
Definition Type.cs:1058
override? Type ReflectedType
Definition Type.cs:59
string? AssemblyQualifiedName
Definition Type.cs:45
string? FullName
Definition Type.cs:47
Type[] GetInterfaces()
static readonly Type[] EmptyTypes
Definition Type.cs:19
MethodInfo[] GetMethods()
Definition Type.cs:788
virtual InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods|DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
Definition Type.cs:1015
bool IsAbstract
Definition Type.cs:175
static ? Type GetType(string typeName, Func< AssemblyName, Assembly?>? assemblyResolver, Func< Assembly?, string, bool, Type?>? typeResolver)
Definition Type.cs:429
virtual TypeCode GetTypeCodeImpl()
Definition Type.cs:924
Guid GUID
Definition Type.cs:293
static bool operator!=(Type? left, Type? right)
override string ToString()
Definition Type.cs:1108
static ArgumentException CreateGetMemberWithSameMetadataDefinitionAsNotFoundException(MemberInfo member)
Definition Type.cs:666
bool IsContextful
Definition Type.cs:225
virtual bool IsValueTypeImpl()
Definition Type.cs:536
virtual bool IsGenericTypeDefinition
Definition Type.cs:113
virtual bool ContainsGenericParameters
Definition Type.cs:336
object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, CultureInfo? culture)
Definition Type.cs:993
MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:751
MethodInfo? GetMethod(string name)
Definition Type.cs:675
MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types, ParameterModifier[]? modifiers)
Definition Type.cs:745
bool IsByRef
Definition Type.cs:73
ConstructorInfo[] GetConstructors()
Definition Type.cs:580
static Type MakeGenericMethodParameter(int position)
Definition Type.cs:1089
virtual Type GetGenericTypeDefinition()
Definition Type.cs:495
EventInfo? GetEvent(string name, BindingFlags bindingAttr)
MemberInfo[] GetMember(string name)
Definition Type.cs:625
virtual Type MakeByRefType()
Definition Type.cs:1068
static readonly MemberFilter FilterName
Definition Type.cs:25
bool IsCOMObjectImpl()
bool IsNestedPublic
Definition Type.cs:205
bool IsSealed
Definition Type.cs:179
virtual Type MakePointerType()
Definition Type.cs:1079
MethodInfo[] GetMethods(BindingFlags bindingAttr)
MemberInfo[] GetMembers()
Definition Type.cs:643
MethodInfo? GetMethod(string name, Type[] types)
Definition Type.cs:697
static ? Type GetTypeFromCLSID(Guid clsid)
Definition Type.cs:935
bool IsArrayImpl()
virtual RuntimeTypeHandle TypeHandle
Definition Type.cs:286
virtual EventInfo[] GetEvents()
Definition Type.cs:598
delegate bool TypeFilter(Type m, object? filterCriteria)
delegate bool MemberFilter(MemberInfo m, object? filterCriteria)
TypeCode
Definition TypeCode.cs:4
ReadOnlySpan< T > Slice(int start)
static bool IsInterface(RuntimeType type)
static bool IsVisible(RuntimeType type)