There are two signatures for generated print methods which are as follows:
The first signature generated allows printing to any output stream:
public override void Print (System.IO.StreamWriter outs, string varName, int level)
The outs argument specifies a System.IO.StreamWriter object to which the output will be written. The C# class System.IO.Stream may be populated with System.Console.Out to write directly to standard output.
The varName argument is used to specify the top-level variable name of the item being printed. Normally, this would be set to the same name as the variable declared in your program that holds the object being printed. For example, if you declared a variable called personnelRecord to hold a PersonnelRecord object, the varName object would be set to “personnelRecord”.
The level argument is used to specify the indentation level for printing nested types. The user would always want to set this to zero at the outer-level.
The second signature exists in the Asn1Type base class. This provides a simplified interface for printing to standard output. In this case, the outs and level arguments are omitted:
public override void Print (string varName)
The varName argument is same as in the first case above.
For example, the call to print the personnelRecord from the previous examples would be as follows:
personnelRecord.Print ("personnelRecord");
The output would be formatted as follows:
personnelRecord { name { givenName = 'John' initial = 'P' familyName = 'Smith' } number = 51 title = 'Director' dateOfHire = '19710917' nameOfSpouse { givenName = 'Mary' initial = 'T' familyName = 'Smith' } children[0] { name { givenName = 'Ralph' initial = 'T' familyName = 'Smith' } dateOfBirth = '19571111' } children[1] { name { givenName = 'Susan' initial = 'B' familyName = 'Jones' } dateOfBirth = '19590717' } }