英語で読む 編集

次の方法で共有


Enum.GetValuesAsUnderlyingType Method

Definition

Overloads

GetValuesAsUnderlyingType(Type)

Retrieves an array of the values of the underlying type constants in a specified enumeration.

GetValuesAsUnderlyingType<TEnum>()

Retrieves an array of the values of the underlying type constants in a specified enumeration type.

GetValuesAsUnderlyingType(Type)

Source:
Enum.cs
Source:
Enum.cs
Source:
Enum.cs

Retrieves an array of the values of the underlying type constants in a specified enumeration.

C#
public static Array GetValuesAsUnderlyingType(Type enumType);

Parameters

enumType
Type

An enumeration type.

Returns

An array that contains the values of the underlying type constants in enumType.

Exceptions

enumType is null.

enumType is not an enumeration type.

Remarks

You can use this method to get enumeration values when it's hard to create an array of the enumeration type. For example, you might use this method for the MetadataLoadContext enumeration or on a platform where run-time code generation is not available.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET 7, 8, 9, 10

GetValuesAsUnderlyingType<TEnum>()

Source:
Enum.cs
Source:
Enum.cs
Source:
Enum.cs

Retrieves an array of the values of the underlying type constants in a specified enumeration type.

C#
public static Array GetValuesAsUnderlyingType<TEnum>() where TEnum : struct;

Type Parameters

TEnum

An enumeration type.

Returns

An array that contains the values of the underlying type constants in TEnum.

Remarks

You can use this method to get enumeration values when it's hard to create an array of the enumeration type. For example, you might use this method for the MetadataLoadContext enumeration or on a platform where run-time code generation is not available.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET 7, 8, 9, 10