public static void Read(DryadLinqBinaryReader reader, out ForkValue <T> val) { val = new ForkValue <T>(); if (reader.ReadBool()) { val.Value = serializer.Read(reader); } }
public static void Read(DryadLinqBinaryReader reader, out Nullable <T> val) { bool hasValue = reader.ReadBool(); if (hasValue) { val = serializer.Read(reader); } else { val = null; } }
// // sample recursive custom serializer // public UDT_CircularTypeWithCustomSerializer Read(DryadLinqBinaryReader reader) { UDT_CircularTypeWithCustomSerializer obj = new UDT_CircularTypeWithCustomSerializer(); bool bHasValidNext = reader.ReadBool(); obj.m_field1 = reader.ReadInt32(); if (bHasValidNext) { obj.m_next = this.Read(reader); // recursively read the next } else { obj.m_next = null; // terminate recursion } return(obj); }
public override bool Read(DryadLinqBinaryReader reader) { return(reader.ReadBool()); }