src\runtime\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)
1357RuntimeType enumType = (RuntimeType)GetType();
1374static string HandleRareTypes(RuntimeType enumType, ref byte rawData) =>
1405RuntimeType enumType = (RuntimeType)GetType();
1425static string HandleRareTypes(RuntimeType enumType, char formatChar, ref byte rawData) =>
1452private static string ToString<TUnderlying, TStorage>(RuntimeType enumType, ref byte rawData)
1464private static string ToStringInlined<TUnderlying, TStorage>(RuntimeType enumType, ref byte rawData)
1481private static string ToString<TUnderlying, TStorage>(RuntimeType enumType, char format, ref byte rawData)
1494private static string ToStringInlined<TUnderlying, TStorage>(RuntimeType enumType, char format, ref byte rawData)
1630RuntimeType rtType = ValidateRuntimeType(enumType);
1690RuntimeType enumType = (RuntimeType)GetType();
1750RuntimeType rt = (RuntimeType)typeof(TEnum);
1809RuntimeType rt = (RuntimeType)typeof(TEnum);
1857private static bool TryFormatPrimitiveDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten)
1892private static bool TryFormatPrimitiveNonDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format)
2126private static RuntimeType ValidateRuntimeType(Type enumType)
2130RuntimeType? rt = enumType as RuntimeType;
2148throw new ArgumentException(enumType is not RuntimeType ? SR.Arg_MustBeType : SR.Arg_MustBeEnum, nameof(enumType));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\RuntimeCustomAttributeData.cs (60)
32internal static IList<CustomAttributeData> GetCustomAttributesInternal(RuntimeType target)
38PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
48PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
58PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
108PseudoCustomAttribute.GetCustomAttributes(target, (RuntimeType)typeof(object), ref pcas);
127internal static CustomAttributeEncoding TypeToCustomAttributeEncoding(RuntimeType type)
237m_ctorParams[i] = new CustomAttributeCtorParameter(new CustomAttributeType((RuntimeType)parameters[i].ParameterType));
256new CustomAttributeType((RuntimeType)fi.FieldType));
264new CustomAttributeType((RuntimeType)pi.PropertyType));
805public CustomAttributeType(RuntimeType parameterType)
815parameterType = (RuntimeType)parameterType.GetElementType()!;
823encodedEnumType = RuntimeCustomAttributeData.TypeToCustomAttributeEncoding((RuntimeType)Enum.GetUnderlyingType(parameterType));
842internal static bool IsDefined(RuntimeType type, RuntimeType? caType, bool inherit)
858type = (type.BaseType as RuntimeType)!;
865type = (type.BaseType as RuntimeType)!;
871internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
898internal static bool IsDefined(RuntimeConstructorInfo ctor, RuntimeType caType)
908internal static bool IsDefined(RuntimePropertyInfo property, RuntimeType caType)
918internal static bool IsDefined(RuntimeEventInfo e, RuntimeType caType)
928internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType caType)
939internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType caType)
950internal static bool IsDefined(RuntimeAssembly assembly, RuntimeType caType)
959internal static bool IsDefined(RuntimeModule module, RuntimeType caType)
969internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit)
978type = (type.GetGenericTypeDefinition() as RuntimeType)!;
1003type = (type.BaseType as RuntimeType)!;
1004} while (type != (RuntimeType)typeof(object) && type != null);
1014internal static object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit)
1056internal static object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType)
1066internal static object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
1076internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType)
1086internal static object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType)
1098internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType)
1110internal static object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
1120internal static object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType)
1132int pcaCount, RuntimeType attributeFilterType)
1146private static bool MatchesTypeFilter(RuntimeType attributeType, RuntimeType attributeFilterType)
1150for (RuntimeType? type = attributeType; type != null; type = (RuntimeType?)type.BaseType)
1163RuntimeType attributeType, bool mustBeInheritable, ref ListBuilder<object> derivedAttributes)
1198internal static AttributeUsageAttribute GetAttributeUsage(RuntimeType decoratedAttribute)
1238internal static object[] CreateAttributeArrayHelper(RuntimeType caType, int elementCount)
1287private static readonly HashSet<RuntimeType> s_pca = CreatePseudoCustomAttributeHashSet();
1291private static HashSet<RuntimeType> CreatePseudoCustomAttributeHashSet()
1309HashSet<RuntimeType> set = new HashSet<RuntimeType>(pcas.Length);
1310foreach (RuntimeType runtimeType in pcas)
1323internal static void GetCustomAttributes(RuntimeType type, RuntimeType caType, ref ListBuilder<Attribute> pcas)
1345internal static bool IsDefined(RuntimeType type, RuntimeType? caType)
1367internal static void GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, ref ListBuilder<Attribute> pcas)
1390internal static bool IsDefined(RuntimeMethodInfo method, RuntimeType? caType)
1413internal static void GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType, ref ListBuilder<Attribute> pcas)
1446internal static bool IsDefined(RuntimeParameterInfo parameter, RuntimeType? caType)
1475internal static void GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType, ref ListBuilder<Attribute> pcas)
1507internal static bool IsDefined(RuntimeFieldInfo field, RuntimeType? caType)
System\Reflection\RuntimeCustomAttributeData.NativeAot.cs (19)
29public QCustomAttributeList(RuntimeType target)
79RuntimeType attributeType = (RuntimeType)customAttribute.GetAttributeTypeHandle(reader)
89RuntimeType attributeType)
195RuntimeType argumentType = (RuntimeType)namedArgument.Type.Resolve(module, default).ToType();
201internal static object? ParseValue(MetadataReader reader, Handle value, RuntimeType argumentType)
568RuntimeType enumType = (RuntimeType)enumTypeHandle.Resolve(_reader, default).ToType();
575RuntimeCustomAttributeData.TypeToCustomAttributeEncoding((RuntimeType)enumType.GetEnumUnderlyingType());
601RuntimeType attributeFilterType,
630RuntimeType attributeFilterType,
633out RuntimeType attributeType)
636attributeType = (RuntimeType)attributeTypeHandle.Resolve(reader, new TypeContext(null, null)).ToType();
653RuntimeType? attributeFilterType,
671out RuntimeType attributeType))
695(RuntimeType)constructorParameters[index].ParameterType);
707RuntimeType type = (RuntimeType)namedArgument.Type.Resolve(reader, default).ToType();