public void DeSerialize(ref int position, byte[] dataBytes) { if (dataBytes[position++] == 0) { return; } var count = CommonSerializer.GetInt(ref position, dataBytes); Goods = new List <Good>(); for (int i = 0; i < count; i++) { var tmpGood = new Good(); tmpGood.DeSerialize(ref position, dataBytes); Goods.Add(tmpGood); } }