Generated C# Method Format and Calling Parameters

The signature for a C# BER decode method is as follows:

   public override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging,
                                int implicitLength)

The buffer argument is a reference of an Asn1BerDecodeBuffer object that describes the message that is being decoded. This must be created and initialized before calling any decode method. See the description of this class in the C# Run- Time Classes section for details on how this class is used.

The explicitTagging and implicitLength arguments specify whether or not an explicit tag should be parsed from the encoded contents. The average user will almost always want to set explicitTagging to true and implicitLength to zero. The only time these arguments would not be set this way is if a user wanted to directly decode contents with no tag/length information. These arguments are used primarily by the compiler when generating internal calls to properly handle implicit and explicit tagging.

The decode method returns no result. Unlike the C/C++ version, a negative status value is not returned to indicate a failure. That is handled by the exception mechanism. All ASN1C C# exceptions are derived from the Asn1Exception base class. See the section on exceptions for a complete list and description of the various ASN.1 exceptions that can be thrown. The System.Exception that can be thrown is in the Read method within the decode buffer base class, for any IO errors. This method attempts to read data from an input stream using the methods in the System.IO.Stream.