public override void WriteTo(GGWriter writer) { writer.WriteStartArray(_items.Count); if (_items.Count > 0) { for (int i = 0; i < _items.Count - 1; i++) { _items[i].WriteTo(writer); writer.WriteArrayDelimiter(); } _items[_items.Count - 1].WriteTo(writer); } writer.WriteEndArray(); }
public override void WriteTo(GGWriter writer) { writer.WriteStartHash(Pairs.Count); if (Pairs.Count > 0) { foreach (var pair in Pairs.Take(Pairs.Count - 1)) { writer.WriteHashName(pair.Key); pair.Value.WriteTo(writer); writer.WriteHashDelimiter(); } var lastPair = Pairs.Last(); writer.WriteHashName(lastPair.Key); lastPair.Value.WriteTo(writer); } writer.WriteEndHash(); }
public override void WriteTo(GGWriter writer) { if (Value is string) { writer.WriteString((string)Value); return; } if (Value is int) { writer.WriteInt((int)Value); return; } if (Value is double) { writer.WriteDouble((double)Value); return; } if (Value == null) { writer.WriteNull(); return; } throw new InvalidOperationException(); }
public abstract void WriteTo(GGWriter writer);