/// <summary> /// Create object from segment in byte array /// </summary> public Root FromBytes(byte[] bytes, ref int index) { // Read Number Number = GeneratorByteConverter.ToInt32(bytes, ref index); // Read Price Price = GeneratorByteConverter.ToDouble(bytes, ref index); // Read Description Description = GeneratorByteConverter.GetString(bytes, ref index); // Read PartialsList var partialslistLength = GeneratorByteConverter.ToUInt16(bytes, ref index); var tempPartialsList = new List <Partial>(partialslistLength); for (var i = 0; i < partialslistLength; i++) { var value = new Partial().FromBytes(bytes, ref index); tempPartialsList.Add(value); } PartialsList = tempPartialsList; // Read PartialsArray var partialsarrayLength = GeneratorByteConverter.ToUInt16(bytes, ref index); var tempPartialsArray = new Partial[partialsarrayLength]; for (var i = 0; i < partialsarrayLength; i++) { var value = new Partial().FromBytes(bytes, ref index); tempPartialsArray[i] = value; } PartialsArray = tempPartialsArray; // Read SmallNumber SmallNumber = GeneratorByteConverter.ToUInt16(bytes, ref index); return(this); }
/// <summary> /// Create object from segment in byte array /// </summary> public SmallNumeric FromBytes(byte[] bytes, ref int index) { // Read Index Index = GeneratorByteConverter.ToUInt16(bytes, ref index); // Read Value Value = GeneratorByteConverter.ToInt32(bytes, ref index); return(this); }