Example class 1:
[AsnSequence]
public class FooQuestion
{
[AsnElement]
public BigInteger TrackingNumber { get; set; }
[AsnElement]
public string Question { get; set; }
}
var myQuestion = new FooQuestion
{
TrackingNumber = 5,
Question = "Anybody there?"
};
AsnConvert.Serialize(myQuestion, AsnEncodingRules.DER);
Output (hex):
30, 13,
02, 01, 05,
16, 0e, 41, 6e, 79, 62, 6f, 64, 79, 20, 74, 68, 65, 72, 65, 3f
var encodedData = new byte[] {
0x30, 0x13, 0x02, 0x01, 0x05, 0x16, 0x0e, 0x41, 0x6e, 0x79, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x3f
};
AsnConvert.Deserialize<FooQuestion>(encodedData, AsnEncodingRules.DER);