Elements within a sequence can be declared to be optional using the OPTIONAL keyword. This indicates that the element is not required in the encoded message.
Optional elements are accounted for in the C# version of the compiler by simply using null object references to denote the absence of an element. Remember that even the simplest primitive ASN.1 type definitions are wrapped in a C# class definition. Therefore an object must be created for any type defined as an element within a SEQUENCE.
To populate a SEQUENCE object for encoding that contains optional elements, the special constructor(s) for required elements only can be used. The default constructor also can be used followed by the manual creation and setting of the individual element values. The default constructor will initialize all element object references to null, so only the items to be encoded need be populated.