Пример #1
0
 private static void WriteItem(BinaryWriter writer, BinCarModel item)
 {
     writer.Write(item.Date);            //Date
     writer.Write(item.BrandNameLength); //Brand Name length
     writer.Write(item.BrandName);       //Brand Name
     writer.Write(item.Price);           //Price
 }
Пример #2
0
 private CarModel MapToModel(BinCarModel item)
 {
     return(new CarModel()
     {
         Date = new DateTime(item.Date),
         BrandName = Encoding.Unicode.GetString(item.BrandName),
         Price = item.Price
     });
 }
Пример #3
0
        private static BinCarModel ReadItem(BinaryReader reader)
        {
            var bin = new BinCarModel();

            bin.Date = reader.ReadInt64();
            var brandNameLength = reader.ReadInt16();

            bin.BrandName = reader.ReadBytes(brandNameLength);
            bin.Price     = reader.ReadInt32();
            return(bin);
        }