Accessing the Choice Element Value after Decoding

To access the element in a choice construct after decoding, the following two methods can be used (both are defined in the Asn1Choice base class):

  1. ChoiceID – this returns an identifier equal to one the generated choice identifier constants, and

  2. GetElement – this returns a reference to the decoded element object. It is of type Asn1Type but it can be upcast to the correct element type using information from the ChoiceID call.

In addition, the compiler generates a ElemName property that can be used to get the textual name of the decoded element.