
SEQUENCE OF
The ASN.1 SEQUENCE OF type is converted to a C# class that inherits the Asn1Type run-time base class. An array public member variable named elements is generated to hold the elements of the defined type.
The compiler first generates a public member variable to hold the SEQUENCE OF elements. The decision was made to make the variable public to make it easier to populate for encoding. The alternative was to use protected or private variables with get/set methods for setting or examining the values. It was felt that this approach would be too cumbersome for setting values in deeply nested constructed types.
Two constructors are generated: a default constructor and a constructor that takes a number of elements argument. The default constructor will set the elements variable to null. The second constructor will allocate space for the given number of elements. The recommended way to populate a variable of this type for encoding is to use the second form of the constructor to allocate the required number of elements and then directly set the element object values. For example, to populate the following construct:
IntSeq ::= SEQUENCE OF INTEGERIntSeq intSeq = new IntSeq (3); intSeq.elements[0] = new Asn1Integer (1); intSeq.elements[1] = new Asn1Integer (2); intSeq.elements[2] = new Asn1Integer (3);
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |