BOOLEAN

The ASN.1 BOOLEAN type is converted to a C# class that inherits the Asn1Boolean run-time class. This base class encapsulates the following public member variable:

   public bool mValue;

This is where the Boolean value to be encoded is stored. It also contains the result of a decode operation. Since it is public, it can be accessed directly to get or set the value. The generated constructors can also be used to set the value.

The following shows the basic mapping from ASN.1 type to C# class definition:

ASN.1 Production:
<name> ::= BOOLEAN
XSD Type:
<xsd:boolean>
Generated C# class:
   public class <name> : Asn1Boolean {
   public <name> () : base() {
   }
   public <name> (bool value_) : base (value_) {
   }
}

This definition assumes a simple assignment of the form “<name> ::= BOOLEAN” (i.e., no tagging or subtypes have been added to the BOOLEAN declaration). In this case, no specific encode or decode methods are generated – calls to these methods pass through to the generic calls defined in the base class. This is true of all other primitive type declarations as well unless otherwise noted.