ASN1C icon ASN.1 to C#

ASN.1 to C# diagram

The ASN1C ASN.1 compiler can generate C# source code for encoding and decoding ASN.1 messages. The following ASN.1 encoding rules are supported:

  • PER - aligned (APER) and unaligned (UPER)
  • OER (including canonical COER)
  • XER and OSys XML

Generation of C# code is very similar to Java code generation. A separate C# class is generated for each production defined in an ASN.1 specification. This contains constructors and methods for encoding and decoding an instance of the class using any of the ASN.1 encoding rules.


  • Intuitive mapping between ASN.1 type and C# classes.
  • In-memory and stream-based encoding and decoding.
  • Support for the .NET Compact Framework.
  • Supports generation of optional methods to print, compare, and copy data.
  • Supports generation of random test data and reader and writer programs
  • Supports generation of makefiles and Visual Studio project files to build generated code.
  • Comprehensive ASN.1 feature coverage including support for table constraints, content constraints, extension element groups, all ASN.1 types, and ASN.1 value notation.
  • SAX-like event handler interface allows for user-defined callbacks