The namespace specification is the second item in the file and is declared using the ‘namespace’ keyword. By default, this is set to the name of the ASN.1 module that is being compiled. However, this can be modified by using the –nspfx and –namespace command line options. The –nspfx option adds the specified prefix before the module name. For example, if an ASN.1 module named ‘Employee’ is being compiled and ‘-nspfx test.’ is specified on the command line, the namespace name in the generated source files would be ‘test.Employee’. The –namespace switch takes this a step further. It allows specification of the full namespace name. In the sample specification above, ‘-nspfx sample_ber.’ was specified on the compiler command line.
Standard using statements are added for the ASN1C C# run-time classes and C# utility classes. Using statements may also be added for items imported from other ASN.1 modules if they don’t exist within the namespace being generated.