TOP

Getting Started

Applies to: ASN.1/C# 5.0

You can start with the tutorials, which include Visual Studio projects with pre-compiled schemas that offer a one-click build. Or, follow the steps below to build any application, including the samples.

  1. Compile your ASN.1 specifications. Use either the ASN.1/C# command-line compiler or ASN.1 Studio. This will produce C# source files that contain the encoding and decoding classes, and the type representations to be used by your application.
  2. Launch your C# development environment.
  3. Reference the runtime codec assembly %ProgramFiles%\OSS Nokalva\asn1csharp\<platform name>\<version>\bin\asn1csrt.dll, which contains the runtime code needed for encoding/decoding.
  4. Write some code using the generated classes and build your application. For example, for the BCAS schema, which is included in the samples:

  5. using Oss.Asn1; 
    using BCAS.BCASModule; 
    using BCAS; 
    
    namespace BCASApp 
        public class Program 
        { 
            public static void Main() 
            { 
                BerCodec codec = new BerCodec(); 
                MemoryStream stream = new MemoryStream(); 
                BBCard pdu = new BBCard(); 
      
                try 
                { 
                    // init PDU 
                    pdu.Name = "Casey"; 
                    pdu.Team = "Mudville Nine"; 
                    pdu.Age = 32; 
                    pdu.Position = "left field"; 
                    pdu.Handedness = BBCard.HandednessType.Ambidextrous; 
                    pdu.BattingAverage = 0.25; 
      
                    // encode PDU 
                    codec.Encode(pdu, stream); 
      
                    // move stream position to beginning for decoding 
                    stream.Position = 0; 
      
                    // decode PDU 
                    codec.Decode(stream, pdu); 
      
                    // print PDU 
                    Console.WriteLine(pdu); 
                } 
                catch (Exception ex) 
                { 
                    Console.WriteLine("Codec exception:" + ex); 
                } 
            } 
        } 
    }
    

  6. C#-compile the generated code to build your application.
  7. Run and test your application.

The sample files included with the software are installed in %ProgramData%\OSS Nokalva\asn1csharp\<platform name>\<version>\samples.

The tutorial files included with the software are installed in %ProgramData%\OSS Nokalva\asn1csharp\<platform name>\<version>\tutorials.


This documentation applies to the OSS® ASN.1 Tools for C# release 5.0 and later.

Copyright © 2020 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C# is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C# are available to you.