/// <summary> /// Initializes a new instance of the <see cref="CborMapReader"/> class. /// </summary> /// <param name="reader"> /// The reader. /// </param> /// <param name="size"> /// The size. /// </param> /// <param name="targeType"> /// The targe type. /// </param> public CborMapReader(CborReader reader, int size, Type targeType) : base(reader) { this.currentSize = size; this.state = ParseState.FIRST_KEY; this.dictionary = (IDictionary)Activator.CreateInstance(targeType); }
/// <summary> /// Initializes a new instance of the <see cref="CborObjectReader"/> class. /// </summary> /// <param name="reader"> /// The reader. /// </param> /// <param name="innerTemplate"> /// The inner template. /// </param> /// <param name="size"> /// The size. /// </param> public CborObjectReader(CborReader reader, CborTypeTemplate innerTemplate, int size) : base(reader) { this.template = innerTemplate; this.currentSize = size; this.obj = Activator.CreateInstance(this.template.type); this.state = ParseState.KEY; this.currentKey = null; }
/// <summary> /// Initializes a new instance of the <see cref="CborListReader"/> class. /// </summary> /// <param name="reader"> /// The reader. /// </param> /// <param name="size"> /// The size. /// </param> /// <param name="targetType"> /// The target type. /// </param> public CborListReader(CborReader reader, int size, Type targetType) : base(reader) { this.currentSize = size; this.elementIndex = 0; if (targetType.IsArray) { this.array = Array.CreateInstance(targetType.GetElementType(), size); } else { this.list = (IList)Activator.CreateInstance(targetType); } }
/// <summary> /// Initializes a new instance of the <see cref="CborTypeReader"/> class. /// </summary> /// <param name="reader"> /// The reader. /// </param> protected CborTypeReader(CborReader reader) { this.reader = reader; reader.Listener = this; this.nextType = null; }