AsnDecoder.ReadEnumeratedValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ReadEnumeratedValue(ReadOnlySpan<Byte>, AsnEncodingRules, Type, Int32, Nullable<Asn1Tag>) |
Reads an Enumerated from |
ReadEnumeratedValue<TEnum>(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>) |
Reads an Enumerated from |
ReadEnumeratedValue(ReadOnlySpan<Byte>, AsnEncodingRules, Type, Int32, Nullable<Asn1Tag>)
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
Reads an Enumerated from source
with a specified tag under the specified encoding rules, converting it to the non-[FlagsAttribute] enum specified by enumType
.
public static Enum ReadEnumeratedValue (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, Type enumType, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default);
static member ReadEnumeratedValue : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * Type * int * Nullable<System.Formats.Asn1.Asn1Tag> -> Enum
Public Shared Function ReadEnumeratedValue (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, enumType As Type, ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As Enum
Parameters
- source
- ReadOnlySpan<Byte>
The buffer containing encoded data.
- ruleSet
- AsnEncodingRules
The encoding constraints to use when interpreting the data.
- enumType
- Type
Type object representing the destination type.
- bytesConsumed
- Int32
When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.
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>(ReadOnlySpan<Byte>, AsnEncodingRules, Int32, Nullable<Asn1Tag>)
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
- Source:
- AsnDecoder.Enumerated.cs
Reads an Enumerated from source
with a specified tag under the specified encoding rules, converting it to the non-[FlagsAttribute] enum specified by TEnum
.
public static TEnum ReadEnumeratedValue<TEnum> (ReadOnlySpan<byte> source, System.Formats.Asn1.AsnEncodingRules ruleSet, out int bytesConsumed, System.Formats.Asn1.Asn1Tag? expectedTag = default) where TEnum : Enum;
static member ReadEnumeratedValue : ReadOnlySpan<byte> * System.Formats.Asn1.AsnEncodingRules * int * Nullable<System.Formats.Asn1.Asn1Tag> -> 'Enum (requires 'Enum :> Enum)
Public Shared Function ReadEnumeratedValue(Of TEnum As Enum) (source As ReadOnlySpan(Of Byte), ruleSet As AsnEncodingRules, ByRef bytesConsumed As Integer, Optional expectedTag As Nullable(Of Asn1Tag) = Nothing) As TEnum
Type Parameters
- TEnum
Destination enum type.
Parameters
- source
- ReadOnlySpan<Byte>
The buffer containing encoded data.
- ruleSet
- AsnEncodingRules
The encoding constraints to use when interpreting the data.
- bytesConsumed
- Int32
When this method returns, the total number of bytes for the encoded value. This parameter is treated as uninitialized.
The tag to check for before reading, or null
for the default tag (Universal 10).
Returns
The Enumerated value converted to a TEnum
.
Exceptions
ruleSet
is not defined.
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.
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
.