src\libraries\System.Private.CoreLib\src\System\Enum.cs (42)
59RuntimeType rt = (RuntimeType)typeof(TEnum);
100internal static string? GetName(RuntimeType enumType, ulong uint64Value)
223RuntimeType rt = (RuntimeType)typeof(TEnum);
256internal static string[] GetNamesNoCopy(RuntimeType enumType)
292Array values = GetValuesAsUnderlyingTypeNoCopy((RuntimeType)typeof(TEnum));
339internal static Array GetValuesAsUnderlyingType(RuntimeType enumType)
369internal static Array GetValuesAsUnderlyingTypeNoCopy(RuntimeType enumType)
474RuntimeType rt = (RuntimeType)typeof(TEnum);
492internal static bool IsDefinedPrimitive<TStorage>(RuntimeType enumType, TStorage value)
723RuntimeType rt = ValidateRuntimeType(enumType);
774static bool TryParseRareTypes(RuntimeType rt, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, [NotNullWhen(true)] out long result)
891RuntimeType rt = (RuntimeType)typeof(TEnum);
915RuntimeType enumType, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, out TUnderlying result)
973RuntimeType enumType, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, out TUnderlying result)
1043private static bool TryParseByName<TStorage>(RuntimeType enumType, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, out TStorage result)
1356RuntimeType enumType = (RuntimeType)GetType();
1373static string HandleRareTypes(RuntimeType enumType, ref byte rawData) =>
1404RuntimeType enumType = (RuntimeType)GetType();
1424static string HandleRareTypes(RuntimeType enumType, char formatChar, ref byte rawData) =>
1451private static string ToString<TUnderlying, TStorage>(RuntimeType enumType, ref byte rawData)
1463private static string ToStringInlined<TUnderlying, TStorage>(RuntimeType enumType, ref byte rawData)
1480private static string ToString<TUnderlying, TStorage>(RuntimeType enumType, char format, ref byte rawData)
1493private static string ToStringInlined<TUnderlying, TStorage>(RuntimeType enumType, char format, ref byte rawData)
1629RuntimeType rtType = ValidateRuntimeType(enumType);
1689RuntimeType enumType = (RuntimeType)GetType();
1749RuntimeType rt = (RuntimeType)typeof(TEnum);
1808RuntimeType rt = (RuntimeType)typeof(TEnum);
1856private static bool TryFormatPrimitiveDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten)
1891private static bool TryFormatPrimitiveNonDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format)
2125private static RuntimeType ValidateRuntimeType(Type enumType)
2129RuntimeType? rt = enumType as RuntimeType;
2147throw new ArgumentException(enumType is not RuntimeType ? SR.Arg_MustBeType : SR.Arg_MustBeEnum, nameof(enumType));
src\libraries\System.Private.CoreLib\src\System\Reflection\FieldAccessor.cs (10)
43RuntimeType fieldType = (RuntimeType)_fieldInfo.FieldType;
178object? ret = RuntimeFieldHandle.GetValue(_fieldInfo, obj, (RuntimeType)_fieldInfo.FieldType, _fieldInfo.m_declaringType, ref isClassInitialized);
193return RuntimeFieldHandle.GetValue(_fieldInfo, obj, (RuntimeType)_fieldInfo.FieldType, _fieldInfo.m_declaringType, ref isClassInitialized);
199if (_fieldInfo.DeclaringType is not null && ((RuntimeType)_fieldInfo.FieldType).IsNullableOfT)
303RuntimeFieldHandle.SetValue(_fieldInfo, obj, value, (RuntimeType)_fieldInfo.FieldType, _fieldInfo.m_declaringType, ref isClassInitialized);
330RuntimeFieldHandle.SetValue(_fieldInfo, obj, value, (RuntimeType)_fieldInfo.FieldType, _fieldInfo.m_declaringType, ref isClassInitialized);
370if (((RuntimeType)_fieldInfo.FieldType).IsActualValueType)
372((RuntimeType)_fieldInfo.FieldType).CheckValue(ref value, binder, culture, invokeAttr);
377((RuntimeType)_fieldInfo.FieldType).CheckValue(ref value, binder, culture, invokeAttr);
src\System\Delegate.CoreCLR.cs (19)
48if (!BindToMethodName(target, (RuntimeType)target.GetType(), method,
64if (target is not RuntimeType rtTarget)
83RuntimeMethodInfo invoke = (RuntimeMethodInfo)RuntimeType.GetMethodBase((RuntimeType)this.GetType(), method)!;
167RuntimeType? declaringType = RuntimeMethodHandle.GetDeclaringType(method);
194declaringType = currentType as RuntimeType;
212declaringType = (RuntimeType)invoke.GetParametersAsSpan()[0].ParameterType;
217_methodBase = (MethodInfo)RuntimeType.GetMethodBase(declaringType, method)!;
231if (type is not RuntimeType rtType)
244if (!d.BindToMethodName(target, (RuntimeType)target.GetType(), method,
268if (type is not RuntimeType rtType)
270if (target is not RuntimeType rtTarget)
301if (type is not RuntimeType rtType)
336if (type is not RuntimeType rtType)
374if (type is not RuntimeType rtType)
395internal static Delegate? CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, object? firstArgument, DelegateBindingFlags flags)
411private bool BindToMethodName(object? target, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.AllMethods)] RuntimeType methodType, string method, DelegateBindingFlags flags)
422private bool BindToMethodInfo(object? target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags)
435private static MulticastDelegate InternalAlloc(RuntimeType type)
src\System\Enum.CoreCLR.cs (27)
18private static unsafe CorElementType InternalGetCorElementType(RuntimeType rt)
35private static readonly RuntimeType?[] s_underlyingTypes =
39(RuntimeType)typeof(bool),
40(RuntimeType)typeof(char),
41(RuntimeType)typeof(sbyte),
42(RuntimeType)typeof(byte),
43(RuntimeType)typeof(short),
44(RuntimeType)typeof(ushort),
45(RuntimeType)typeof(int),
46(RuntimeType)typeof(uint),
47(RuntimeType)typeof(long),
48(RuntimeType)typeof(ulong),
49(RuntimeType)typeof(float),
50(RuntimeType)typeof(double),
61(RuntimeType)typeof(nint),
62(RuntimeType)typeof(nuint)
66internal static unsafe RuntimeType InternalGetUnderlyingType(RuntimeType enumType)
71RuntimeType? underlyingType = s_underlyingTypes[(int)enumType.GetNativeTypeHandle().AsMethodTable()->GetPrimitiveCorElementType()];
79private static EnumInfo<TStorage> GetEnumInfo<TStorage>(RuntimeType enumType, bool getNames = true)
92static EnumInfo<TStorage> InitializeEnumInfo(RuntimeType enumType, bool getNames)
103internal sealed partial class EnumInfo<TStorage> : RuntimeType.IGenericCacheEntry<EnumInfo<TStorage>>
105public static EnumInfo<TStorage> Create(RuntimeType type, bool getNames)
123public static EnumInfo<TStorage> Create(RuntimeType type) => Create(type, getNames: false);
125public void InitializeCompositeCache(RuntimeType.CompositeCacheEntry compositeEntry) => compositeEntry._enumInfo = this;
128public static ref EnumInfo<TStorage>? GetStorageRef(RuntimeType.CompositeCacheEntry compositeEntry)
129=> ref Unsafe.As<RuntimeType.IGenericCacheEntry?, EnumInfo<TStorage>?>(ref compositeEntry._enumInfo);
src\System\Reflection\RtFieldInfo.cs (8)
8using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
20private RuntimeType? m_fieldType;
37RuntimeFieldHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
96return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, obj, (RuntimeType?)DeclaringType);
112RuntimeFieldHandle.SetValueDirect(this, (RuntimeType)FieldType, obj, value, (RuntimeType?)DeclaringType);
131private RuntimeType InitializeFieldType()
src\System\Reflection\RuntimeCustomAttributeData.cs (104)
18internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeType target)
23RuntimeType.ListBuilder<Attribute> pcas = default;
24PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
33RuntimeType.ListBuilder<Attribute> pcas = default;
34PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
43RuntimeType.ListBuilder<Attribute> pcas = default;
44PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
92RuntimeType.ListBuilder<Attribute> pcas = default;
94PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
98private static ReadOnlyCollection<CustomAttributeData> GetCombinedList(IList<CustomAttributeData> customAttributes, ref RuntimeType.ListBuilder<Attribute> pseudoAttributes)
113internal static CustomAttributeEncoding TypeToCustomAttributeEncoding(RuntimeType type)
254m_ctor = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(m_scope, caCtorToken)!;
268m_ctorParams[i] = new CustomAttributeCtorParameter(new CustomAttributeType((RuntimeType)parameters[i].ParameterType));
287new CustomAttributeType((RuntimeType)fi.FieldType));
295new CustomAttributeType((RuntimeType)pi.PropertyType));
543private static RuntimeType ResolveType(RuntimeModule scope, string typeName)
545RuntimeType type = TypeNameResolver.GetTypeReferencedByCustomAttribute(typeName, scope);
902enumTag = RuntimeCustomAttributeData.TypeToCustomAttributeEncoding((RuntimeType)enumType.GetEnumUnderlyingType());
1078public CustomAttributeType(RuntimeType parameterType)
1088parameterType = (RuntimeType)parameterType.GetElementType()!;
1096encodedEnumType = RuntimeCustomAttributeData.TypeToCustomAttributeEncoding((RuntimeType)Enum.GetUnderlyingType(parameterType));
1116internal static bool IsDefined(RuntimeType type, RuntimeType? caType, bool inherit)
1132type = (type.BaseType as RuntimeType)!;
1139type = (type.BaseType as RuntimeType)!;
1145internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
1172internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType)
1182internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType)
1192internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
1202internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
1213internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
1224internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType)
1233internal static bool IsDefined(RuntimeModule module, RuntimeType caType)
1243internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
1252type = (type.GetGenericTypeDefinition() as RuntimeType)!;
1254RuntimeType.ListBuilder<Attribute> pcas = default;
1267RuntimeType.ListBuilder<object> result = default;
1277type = (type.BaseType as RuntimeType)!;
1278} while (type != (RuntimeType)typeof(object) && type != null);
1288internal static object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
1296RuntimeType.ListBuilder<Attribute> pcas = default;
1309RuntimeType.ListBuilder<object> result = default;
1330internal static object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType)
1340internal static object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
1350internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
1360internal static object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType)
1365RuntimeType.ListBuilder<Attribute> pcas = default;
1372internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
1377RuntimeType.ListBuilder<Attribute> pcas = default;
1384internal static object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
1395internal static object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType)
1411RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType? attributeFilterType)
1417RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType? attributeFilterType, int attributeCtorToken, bool mustBeInheritable)
1433RuntimeType.ListBuilder<object> derivedAttributes = default;
1470RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType)
1472RuntimeType.ListBuilder<object> attributes = default;
1489ref RuntimeType.ListBuilder<object> attributes,
1491RuntimeType? attributeFilterType, bool mustBeInheritable,
1493RuntimeType.ListBuilder<object> derivedAttributes)
1513out RuntimeType attributeType, out IRuntimeMethodInfo? ctorWithParameters, out bool isVarArg))
1561GetPropertyOrFieldData(decoratedModule, ref blobStart, blobEnd, out string name, out bool isProperty, out RuntimeType? type, out object? value);
1569type = (RuntimeType)value.GetType();
1570if (type == typeof(RuntimeType))
1572type = (RuntimeType)typeof(Type);
1623RuntimeType attributeFilterType,
1625ref RuntimeType.ListBuilder<object> derivedAttributes,
1626out RuntimeType attributeType,
1634attributeType = (decoratedModule.ResolveType(scope.GetParentToken(caCtorToken), null, null) as RuntimeType)!;
1712private static bool MatchesTypeFilter(RuntimeType attributeType, RuntimeType attributeFilterType)
1716for (RuntimeType? type = attributeType; type != null; type = (RuntimeType?)type.BaseType)
1732RuntimeType attributeType, bool mustBeInheritable, ref RuntimeType.ListBuilder<object> derivedAttributes)
1765internal static AttributeUsageAttribute GetAttributeUsage(RuntimeType decoratedAttribute)
1776RuntimeType? attributeType = decoratedModule.ResolveType(scope.GetParentToken(caRecord.tkCtor), null, null) as RuntimeType;
1778if (attributeType != (RuntimeType)typeof(AttributeUsageAttribute))
1799internal static object[] CreateAttributeArrayHelper(RuntimeType caType, int elementCount)
1871private static object CreateCustomAttributeInstance(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs)
1901RuntimeModule module, ref IntPtr blobStart, IntPtr blobEnd, out string name, out bool isProperty, out RuntimeType? type, out object? value)
1909RuntimeType? typeLocal = null;
1932private static readonly HashSet<RuntimeType> s_pca = CreatePseudoCustomAttributeHashSet();
1936private static HashSet<RuntimeType> CreatePseudoCustomAttributeHashSet()
1954HashSet<RuntimeType> set = new HashSet<RuntimeType>(pcas.Length);
1955foreach (RuntimeType runtimeType in pcas)
1964private static void VerifyPseudoCustomAttribute(RuntimeType pca)
1983internal static void GetCustomAttributes(RuntimeType type, RuntimeType caType, ref RuntimeType.ListBuilder<Attribute> pcas)
2005internal static bool IsDefined(RuntimeType type, RuntimeType? caType)
2027internal static void GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, ref RuntimeType.ListBuilder<Attribute> pcas)
2047internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType? caType)
2067internal static void GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, ref RuntimeType.ListBuilder<Attribute> pcas)
2097internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType? caType)
2123internal static void GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType, ref RuntimeType.ListBuilder<Attribute> pcas)
2152internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType? caType)
2264internal static StructLayoutAttribute? GetStructLayoutCustomAttribute(RuntimeType type)
src\System\Reflection\RuntimeMethodInfo.CoreCLR.cs (30)
12using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
28private readonly RuntimeType m_declaringType;
56RuntimeMethodHandleInternal handle, RuntimeType declaringType,
74private RuntimeType ReflectedTypeInternal => m_reflectedTypeCache.GetRuntimeType();
111RuntimeType? parent = (RuntimeType?)m_declaringType.BaseType;
121return (RuntimeMethodInfo?)RuntimeType.GetMethodBase(parent, RuntimeTypeHandle.GetMethodAt(parent, slot));
125internal RuntimeType GetDeclaringTypeInternal()
174return CustomAttribute.GetCustomAttributes(this, (typeof(object) as RuntimeType)!, inherit);
181if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
191if (attributeType.UnderlyingSystemType is not RuntimeType attributeRuntimeType)
233internal RuntimeType GetRuntimeType() { return m_declaringType; }
271internal RuntimeType[] ArgumentTypes => Signature.Arguments;
330RuntimeType declaringType = (RuntimeType)DeclaringType!;
331RuntimeType? baseDeclaringType = declaringType;
344declaringType = (RuntimeType)declaringType.BaseType!;
347return (MethodInfo)RuntimeType.GetMethodBase(baseDeclaringType, baseMethodHandle)!;
383RuntimeType rtType = delegateType as RuntimeType ??
401RuntimeType[] methodInstantionRuntimeType = new RuntimeType[methodInstantiation.Length];
412RuntimeType? rtMethodInstantiationElem = methodInstantiationElem as RuntimeType;
426RuntimeType[] genericParameters = GetGenericArgumentsInternal();
428RuntimeType.SanityCheckGenericArguments(methodInstantionRuntimeType, genericParameters);
434ret = RuntimeType.GetMethodBase(ReflectedTypeInternal,
439RuntimeType.ValidateGenericArguments(this, methodInstantionRuntimeType, e);
446internal RuntimeType[] GetGenericArgumentsInternal() =>
457return (RuntimeType.GetMethodBase(m_declaringType, RuntimeMethodHandle.StripMethodInstantiation(this)) as MethodInfo)!;
src\System\RuntimeHandles.cs (122)
25internal RuntimeType GetRuntimeTypeChecked() =>
42private static RuntimeType GetRuntimeTypeFromHandleSlow(IntPtr handle)
44RuntimeType? typeObject = null;
50internal static unsafe RuntimeType GetRuntimeTypeFromHandle(IntPtr handle)
59internal static RuntimeType? GetRuntimeTypeFromHandleMaybeNull(IntPtr handle)
70internal static unsafe RuntimeType GetRuntimeType(MethodTable* pMT)
92internal RuntimeType? m_type;
105internal RuntimeTypeHandle(RuntimeType? type)
115internal static bool IsTypeDefinition(RuntimeType type)
133internal static bool IsPrimitive(RuntimeType type)
138internal static bool IsByRef(RuntimeType type)
144internal static bool IsPointer(RuntimeType type)
150internal static bool IsArray(RuntimeType type)
156internal static bool IsSZArray(RuntimeType type)
162internal static bool IsFunctionPointer(RuntimeType type)
168internal static bool HasElementType(RuntimeType type)
227[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] RuntimeType type,
228RuntimeType genericParameter)
250[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] RuntimeType type,
251RuntimeType genericParameter1,
252RuntimeType genericParameter2)
291internal static object InternalAlloc(RuntimeType type)
329RuntimeType rt,
379internal RuntimeType GetRuntimeType()
384internal static RuntimeAssembly GetAssembly(RuntimeType type)
389static RuntimeAssembly GetAssemblyWorker(RuntimeType type)
398private static extern RuntimeAssembly? GetAssemblyIfExists(RuntimeType type);
403internal static RuntimeModule GetModule(RuntimeType type)
408static RuntimeModule GetModuleWorker(RuntimeType type)
417private static extern RuntimeModule? GetModuleIfExists(RuntimeType type);
433internal static extern TypeAttributes GetAttributes(RuntimeType type);
438internal static RuntimeType? GetElementType(RuntimeType type)
446RuntimeType result = GetRuntimeTypeFromHandle(handle);
452internal static extern bool CompareCanonicalHandles(RuntimeType left, RuntimeType right);
455internal static extern int GetArrayRank(RuntimeType type);
458internal static extern int GetToken(RuntimeType type);
463internal static RuntimeMethodHandleInternal GetMethodAt(RuntimeType type, int slot)
479internal static Type[] GetArgumentTypesFromFunctionPointer(RuntimeType type)
491internal static extern bool IsUnmanagedFunctionPointer(RuntimeType type);
499internal IntroducedMethodEnumerator(RuntimeType type)
527internal static IntroducedMethodEnumerator GetIntroducedMethods(RuntimeType type)
533private static extern RuntimeMethodHandleInternal GetFirstIntroducedMethod(RuntimeType type);
541internal static bool GetFields(RuntimeType type, Span<IntPtr> buffer, out int count)
562internal static Type[] GetInterfaces(RuntimeType type)
610internal static extern int GetNumVirtuals(RuntimeType type);
615internal static int GetNumVirtualsAndStaticVirtuals(RuntimeType type)
645internal static bool IsVisible(RuntimeType type)
667internal static MdUtf8String GetUtf8Name(RuntimeType type)
683internal static bool CanCastTo(RuntimeType type, RuntimeType target)
697internal static RuntimeType? GetDeclaringType(RuntimeType type)
719RuntimeType result = GetRuntimeTypeFromHandle(retTypeHandle);
727internal static IRuntimeMethodInfo? GetDeclaringMethodForGenericParameter(RuntimeType type)
739internal RuntimeType[] GetInstantiationInternal()
741RuntimeType[]? types = null;
758internal RuntimeType Instantiate(RuntimeType inst)
762RuntimeType? type = null;
769internal RuntimeType Instantiate(Type[]? inst)
775RuntimeType? type = null;
786internal RuntimeType MakeArray(int rank)
788RuntimeType? type = null;
797internal RuntimeType MakeSZArray()
799RuntimeType? type = null;
808internal RuntimeType MakeByRef()
810RuntimeType? type = null;
819internal RuntimeType MakePointer()
821RuntimeType? type = null;
834internal static extern bool IsGenericVariable(RuntimeType type);
837private static extern int GetGenericVariableIndex(RuntimeType type);
841RuntimeType type = GetRuntimeTypeChecked();
850internal static extern bool ContainsGenericVariables(RuntimeType handle);
860internal static bool SatisfiesConstraints(RuntimeType paramType, RuntimeType? typeContext, RuntimeMethodInfo? methodContext, RuntimeType toType)
871internal static void RegisterCollectibleTypeDependency(RuntimeType type, RuntimeAssembly? assembly)
1094internal static unsafe RuntimeType GetDeclaringType(RuntimeMethodHandleInternal method)
1101internal static RuntimeType GetDeclaringType(IRuntimeMethodInfo method)
1103RuntimeType type = GetDeclaringType(method.Value);
1200internal static object ReboxToNullable(object? src, RuntimeType destNullableType)
1217internal static RuntimeType[] GetMethodInstantiationInternal(IRuntimeMethodInfo method)
1219RuntimeType[]? types = null;
1225internal static RuntimeType[] GetMethodInstantiationInternal(RuntimeMethodHandleInternal method)
1227RuntimeType[]? types = null;
1234RuntimeType[]? types = null;
1251private static extern RuntimeMethodHandleInternal GetStubIfNeededInternal(RuntimeMethodHandleInternal method, RuntimeType declaringType);
1256internal static RuntimeMethodHandleInternal GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[]? methodInstantiation)
1268static RuntimeMethodHandleInternal GetStubIfNeededWorker(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[]? methodInstantiation)
1273internal static extern RuntimeMethodHandleInternal GetMethodFromCanonical(RuntimeMethodHandleInternal method, RuntimeType declaringType);
1332internal static RuntimeMethodBody? GetMethodBody(IRuntimeMethodInfo method, RuntimeType declaringType)
1523internal static RuntimeType GetApproxDeclaringType(RuntimeFieldHandleInternal field)
1532internal static RuntimeType GetApproxDeclaringType(IRuntimeFieldInfo field)
1534RuntimeType type = GetApproxDeclaringType(field.Value);
1590internal static object? GetValue(RtFieldInfo field, object? instance, RuntimeType fieldType, RuntimeType? declaringType, ref bool isClassInitialized)
1611internal static object? GetValueDirect(RtFieldInfo field, RuntimeType fieldType, TypedReference typedRef, RuntimeType? contextType)
1633internal static void SetValue(RtFieldInfo field, object? obj, object? value, RuntimeType fieldType, RuntimeType? declaringType, ref bool isClassInitialized)
1652internal static void SetValueDirect(RtFieldInfo field, RuntimeType fieldType, TypedReference typedRef, object? value, RuntimeType? contextType)
1666internal static RuntimeFieldHandleInternal GetStaticFieldForGenericType(RuntimeFieldHandleInternal field, RuntimeType declaringType)
1845RuntimeType? type = null;
1979internal static RuntimeType GetModuleType(RuntimeModule module)
1981RuntimeType? type = null;
2014private RuntimeType[]? _arguments;
2015private RuntimeType _declaringType;
2016private RuntimeType _returnTypeORfieldType;
2053RuntimeType[] arguments,
2054RuntimeType returnType,
2068public Signature(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
2075public Signature(IRuntimeFieldInfo fieldHandle, RuntimeType declaringType)
2082public Signature(void* pCorSig, int cCorSig, RuntimeType declaringType)
2091internal RuntimeType[] Arguments
2099internal RuntimeType ReturnType => _returnTypeORfieldType;
2100internal RuntimeType FieldType => _returnTypeORfieldType;
2199internal abstract RuntimeType? GetJitContext(out int securityControlFlags);
src\System\RuntimeType.CoreCLR.cs (130)
207internal MethodBase AddMethod(RuntimeType declaringType, RuntimeMethodHandleInternal method, CacheType cacheType)
308RuntimeType approxDeclaringType = RuntimeFieldHandle.GetApproxDeclaringType(field);
579RuntimeType declaringType = ReflectedType;
745RuntimeType declaringType = ReflectedType;
793RuntimeType declaringType = ReflectedType;
799RuntimeType? populatingType = declaringType;
824PopulateLiteralFields(filter, (RuntimeType)iface, ref list);
825PopulateRtFields(filter, (RuntimeType)iface, ref list);
832private unsafe void PopulateRtFields(Filter filter, RuntimeType declaringType, ref ListBuilder<RuntimeFieldInfo> list)
849ReadOnlySpan<IntPtr> fieldHandles, RuntimeType declaringType, ref ListBuilder<RuntimeFieldInfo> list)
895private void PopulateLiteralFields(Filter filter, RuntimeType declaringType, ref ListBuilder<RuntimeFieldInfo> list)
955ref ListBuilder<RuntimeType> list,
957[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] RuntimeType iList,
970RuntimeType iFace = (RuntimeType)iFaces[j];
982private RuntimeType[] PopulateInterfaces(Filter filter)
984ListBuilder<RuntimeType> list = default;
986RuntimeType declaringType = ReflectedType;
993RuntimeType interfaceType = (RuntimeType)iface;
1007RuntimeType arrayType = (RuntimeType)ReflectedType.GetElementType()!;
1011AddSpecialInterface(ref list, filter, (RuntimeType)typeof(IList<>).MakeGenericType(arrayType), true);
1015AddSpecialInterface(ref list, filter, (RuntimeType)typeof(IReadOnlyList<>).MakeGenericType(arrayType), false);
1016AddSpecialInterface(ref list, filter, (RuntimeType)typeof(IReadOnlyCollection<>).MakeGenericType(arrayType), false);
1022var al = new HashSet<RuntimeType>();
1030RuntimeType constraint = (RuntimeType)constraints[i];
1036al.Add((RuntimeType)temp[j]);
1040foreach (RuntimeType rt in al)
1056private RuntimeType[] PopulateNestedClasses(Filter filter)
1058RuntimeType declaringType = ReflectedType;
1069return Array.Empty<RuntimeType>();
1071ListBuilder<RuntimeType> list = default;
1080RuntimeType nestedType;
1113RuntimeType declaringType = ReflectedType;
1122RuntimeType? populatingType = declaringType;
1139Filter filter, RuntimeType declaringType, Dictionary<string, RuntimeEventInfo>? csEventInfos, ref ListBuilder<RuntimeEventInfo> list)
1204RuntimeType declaringType = ReflectedType;
1224RuntimeType? populatingType = declaringType;
1242RuntimeType declaringType,
1393internal RuntimeType ReflectedType => m_runtimeTypeCache.GetRuntimeType();
1400private readonly RuntimeType m_runtimeType;
1401private RuntimeType? m_enclosingType;
1412private MemberInfoCache<RuntimeType>? m_interfaceCache;
1413private MemberInfoCache<RuntimeType>? m_nestedClassesCache;
1422private RuntimeType? _genericTypeDefinition;
1426internal RuntimeTypeCache(RuntimeType runtimeType)
1476public static FunctionPointerCache Create(RuntimeType type)
1481public void InitializeCompositeCache(RuntimeType.CompositeCacheEntry compositeEntry) => compositeEntry._functionPointerCache = this;
1482public static ref FunctionPointerCache? GetStorageRef(RuntimeType.CompositeCacheEntry compositeEntry) => ref compositeEntry._functionPointerCache;
1522RuntimeModule module = ((RuntimeType)type).GetRuntimeModule();
1536internal RuntimeType? GetEnclosingType()
1541RuntimeType? enclosingType = RuntimeTypeHandle.GetDeclaringType(GetRuntimeType());
1543m_enclosingType = enclosingType ?? (RuntimeType)typeof(void);
1549internal RuntimeType GetRuntimeType() => m_runtimeType;
1561for (RuntimeType? t = m_runtimeType; t != null; t = t.GetBaseType())
1586internal RuntimeType GetGenericTypeDefinition()
1593RuntimeType CacheGenericDefinition()
1595RuntimeType genericDefinition = null!;
1602RuntimeType type = m_runtimeType;
1690internal RuntimeType[] GetInterfaceList(MemberListType listType, string? name)
1695internal RuntimeType[] GetNestedTypeList(MemberListType listType, string? name)
1700internal MethodBase GetMethod(RuntimeType declaringType, RuntimeMethodHandleInternal method)
1706internal MethodBase GetConstructor(RuntimeType declaringType, RuntimeMethodHandleInternal constructor)
1728internal unsafe RuntimeType? GetParentType()
1742RuntimeType result = RuntimeTypeHandle.GetRuntimeType(pParentMT);
1758internal static MethodBase? GetMethodBase(RuntimeType? reflectedType, IRuntimeMethodInfo methodHandle)
1768internal static MethodBase? GetMethodBase(RuntimeType? reflectedType, RuntimeMethodHandleInternal methodHandle)
1783RuntimeType declaredType = RuntimeMethodHandle.GetDeclaringType(methodHandle);
1785RuntimeType[]? methodInstantiation = null;
1821RuntimeType declaringDefinition = (RuntimeType)declaredType.GetGenericTypeDefinition();
1823RuntimeType? baseType = reflectedType;
1827RuntimeType baseDefinition = baseType;
1830baseDefinition = (RuntimeType)baseDefinition.GetGenericTypeDefinition();
1921internal static FieldInfo GetFieldInfo(RuntimeType? reflectedType, IRuntimeFieldInfo field)
1932RuntimeType declaredType = RuntimeFieldHandle.GetApproxDeclaringType(fieldHandle);
1952private static RuntimePropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
1969internal static void ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception? e)
1971RuntimeType? typeContext;
1973RuntimeType[] genericParameters;
1977typeContext = (RuntimeType)definition;
1983typeContext = (RuntimeType?)methodContext.DeclaringType;
2200Debug.Assert(type is RuntimeType);
2362internal static readonly RuntimeType ValueType = (RuntimeType)typeof(ValueType);
2364private static readonly RuntimeType ObjectType = (RuntimeType)typeof(object);
2365private static readonly RuntimeType StringType = (RuntimeType)typeof(string);
2388return (o is RuntimeType t) && (t.m_handle == m_handle);
2595RuntimeType[] cache = Cache.GetNestedTypeList(listType, name);
2600RuntimeType nestedClass = cache[i];
2645RuntimeType[] candidates = Cache.GetInterfaceList(MemberListType.All, null);
2693RuntimeType ifaceRtType = interfaceType as RuntimeType ??
2741RuntimeType reflectedType = RuntimeMethodHandle.GetDeclaringType(classRtMethodHandle);
2971RuntimeType[] cache = Cache.GetInterfaceList(listType, name);
2973RuntimeType? match = null;
2977RuntimeType iface = cache[i];
3000RuntimeType[] cache = Cache.GetNestedTypeList(listType, name);
3002RuntimeType? match = null;
3006RuntimeType nestedType = cache[i];
3106RuntimeType? runtimeType = this;
3131private static RuntimeMethodInfo? GetMethodWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo method)
3147private static RuntimeConstructorInfo? GetConstructorWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo constructor)
3163private static RuntimePropertyInfo? GetPropertyWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo property)
3179private static RuntimeFieldInfo? GetFieldWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo field)
3195private static RuntimeEventInfo? GetEventWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo eventInfo)
3211private static RuntimeType? GetNestedTypeWithSameMetadataDefinitionAs(RuntimeType runtimeType, MemberInfo nestedType)
3213RuntimeType[] cache = runtimeType.Cache.GetNestedTypeList(MemberListType.CaseSensitive, nestedType.Name);
3217RuntimeType candidate = cache[i];
3234RuntimeType thisType = this;
3261RuntimeType? rtType = type as RuntimeType;
3265RuntimeType? baseType = GetBaseType();
3538internal RuntimeType[] GetGenericArgumentsInternal()
3557RuntimeType[] genericParameters = GetGenericArgumentsInternal();
3561if (typeArguments.Length == 1 && typeArguments[0] is RuntimeType rt)
3575RuntimeType[] instantiationRuntimeType = new RuntimeType[typeArguments.Length];
3582RuntimeType? rtInstantiationElem = instantiationElem as RuntimeType;
3664public sealed override bool HasSameMetadataDefinitionAs(MemberInfo other) => HasSameMetadataDefinitionAsCore<RuntimeType>(other);
3686private static bool CanValueSpecialCast(RuntimeType valueType, RuntimeType targetType)
3722RuntimeType srcType = pointer != null ? pointer.GetPointerType() : (RuntimeType)value.GetType();