Пример #1
0
        public Offset <RoadData> Serialize(FlatBufferBuilder flatBufferBuilder)
        {
            var idOffset = flatBufferBuilder.CreateString(Id);
            var list     = new List <Offset <NodeData> >();

            for (int i = 0; i < Positions.Count; i++)
            {
                list.Add(Positions[i].Serialize(flatBufferBuilder));
            }

            var positionsOffset = RoadData.CreatePositionsVector(flatBufferBuilder, list.ToArray());
            var infoOffset      = InfoList.Serialize(flatBufferBuilder);

            RoadData.StartRoadData(flatBufferBuilder);
            RoadData.AddId(flatBufferBuilder, idOffset);
            RoadData.AddPositions(flatBufferBuilder, positionsOffset);
            RoadData.AddInfo(flatBufferBuilder, infoOffset);
            var endOffset = RoadData.EndRoadData(flatBufferBuilder);

            return(endOffset);
        }