AsnReader.ReadEnumeratedValue 方法
定义
重载
| ReadEnumeratedValue(Type, Nullable<Asn1Tag>) |
读取下一个值,作为带有指定标记的枚举值,并将其转换为由 |
| ReadEnumeratedValue<TEnum>(Nullable<Asn1Tag>) |
读取下一个值,作为带有指定标记的枚举值,并将其转换为由 |
ReadEnumeratedValue(Type, Nullable<Asn1Tag>)
读取下一个值,作为带有指定标记的枚举值,并将其转换为由 enumType 指定的非 [FlagsAttribute] 枚举。Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by enumType.
public Enum ReadEnumeratedValue (Type enumType, System.Formats.Asn1.Asn1Tag? expectedTag = default);
member this.ReadEnumeratedValue : Type * Nullable<System.Formats.Asn1.Asn1Tag> -> Enum
Public Function ReadEnumeratedValue (enumType As Type, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Enum
参数
- enumType
- Type
表示目标类型的类型对象。Type object representing the destination type.
读取前要检查的标记,或使用 null 作为默认标记(通用 10)。The tag to check for before reading, or null for the default tag (Universal 10).
返回
转换为 enumType 的枚举值。The Enumerated value converted to a enumType.
例外
下一个值没有正确的标记。the next value does not have the correct tag.
-或- 在当前编码规则下,长度编码无效。-or- the length encoding is not valid under the current encoding rules.
-或- 在当前编码规则下,内容无效。-or- the contents are not valid under the current encoding rules.
-或- 编码值太大,无法容纳 enumType 值。-or- the encoded value is too big to fit in a enumType value.
enumType 不是一个枚举类型。enumType is not an enum type.
-或- enumType 是使用 FlagsAttribute 声明的。-or- enumType was declared with FlagsAttribute.
-或- enumType.TagClass-or- enumType.TagClass 为 Universal,但 enumType.TagValueis Universal, but enumType.TagValue 对于此方法而言是不正确的。is not correct for the method.
enumType 为 null。enumType is null.
注解
此方法不会验证中是否定义了返回值 enumType 。This method does not validate that the return value is defined within enumType.
适用于
ReadEnumeratedValue<TEnum>(Nullable<Asn1Tag>)
读取下一个值,作为带有指定标记的枚举值,并将其转换为由 TEnum 指定的非 [FlagsAttribute] 枚举。Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by TEnum.
public TEnum ReadEnumeratedValue<TEnum> (System.Formats.Asn1.Asn1Tag? expectedTag = default) where TEnum : Enum;
member this.ReadEnumeratedValue : Nullable<System.Formats.Asn1.Asn1Tag> -> 'Enum (requires 'Enum :> Enum)
Public Function ReadEnumeratedValue(Of TEnum As Enum) (Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As TEnum
类型参数
- TEnum
目标枚举类型Destination enum type
参数
读取前要检查的标记,或使用 null 作为默认标记(通用 10)。The tag to check for before reading, or null for the default tag (Universal 10).
返回
- TEnum
转换为 TEnum 的枚举值。The Enumerated value converted to a TEnum.
例外
下一个值没有正确的标记。the next value does not have the correct tag.
-或- 在当前编码规则下,长度编码无效。-or- the length encoding is not valid under the current encoding rules.
-或- 在当前编码规则下,内容无效。-or- the contents are not valid under the current encoding rules.
-或- 编码值太大,无法容纳 TEnum 值。-or- the encoded value is too big to fit in a TEnum value.
TEnum 不是一个枚举类型。TEnum is not an enum type.
-或- TEnum 是使用 FlagsAttribute 声明的。-or- TEnum was declared with FlagsAttribute.
-或- expectedTag.TagClass-or- expectedTag.TagClass 为 Universal,但 expectedTag.TagValueis Universal, but expectedTag.TagValue 对于此方法而言是不正确的。is not correct for the method.
注解
此方法不会验证是否在 <typeparamref name = "TEnum> 中定义了返回值。This method does not validate that the return value is defined within <typeparamref name="TEnum>.