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

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-

enumType was declared with FlagsAttribute.

-or-

enumType.TagClass is Universal, but enumType.TagValue 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

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

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-

TEnum was declared with FlagsAttribute.

-or-

expectedTag.TagClass is Universal, but expectedTag.TagValue is not correct for the method.

Remarks

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

Applies to