แชร์ผ่าน


AsnReader.ReadEnumeratedValue Method

Definition

Overloads

ReadEnumeratedValue(Type, Nullable<Asn1Tag>)

Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by enumType.

ReadEnumeratedValue<TEnum>(Nullable<Asn1Tag>)

Reads the next value as an Enumerated with a specified tag, converting it to the non-[FlagsAttribute] enum specified by TEnum.

ReadEnumeratedValue(Type, Nullable<Asn1Tag>)

Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs

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

Parameters

enumType
Type

Type object representing the destination type.

expectedTag
Nullable<Asn1Tag>

The tag to check for before reading, or null for the default tag (Universal 10).

Returns

The Enumerated value converted to a enumType.

Exceptions

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.

-or-

The encoded value is too big to fit in a enumType value.

enumType is not an enum type.

 -or-

 <code data-dev-comment-type="paramref">enumType</code> was declared with <xref data-throw-if-not-resolved="true" uid="System.FlagsAttribute"></xref>.

 -or-

 <code data-dev-comment-type="paramref">enumType</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagClass"></xref> is
 <xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.TagClass.Universal"></xref>, but
 <code data-dev-comment-type="paramref">enumType</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagValue"></xref> is not correct for
 the method.

enumType is null.

Remarks

This method does not validate that the return value is defined within enumType.

Applies to

ReadEnumeratedValue<TEnum>(Nullable<Asn1Tag>)

Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs
Source:
AsnDecoder.Enumerated.cs

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

Type Parameters

TEnum

The destination enum type.

Parameters

expectedTag
Nullable<Asn1Tag>

The tag to check for before reading, or null for the default tag (Universal 10).

Returns

TEnum

The Enumerated value converted to a TEnum.

Exceptions

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.

-or-

The encoded value is too big to fit in a TEnum value.

TEnum is not an enum type.

 -or-

 <code data-dev-comment-type="typeparamref">TEnum</code> was declared with <xref data-throw-if-not-resolved="true" uid="System.FlagsAttribute"></xref>.

 -or-

 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagClass"></xref> is
 <xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.TagClass.Universal"></xref>, but
 <code data-dev-comment-type="paramref">expectedTag</code>.<xref data-throw-if-not-resolved="true" uid="System.Formats.Asn1.Asn1Tag.TagValue"></xref> is not correct for
 the method.

Remarks

This method does not validate that the return value is defined within TEnum.

Applies to