public void Serialize(System.IO.Stream stream, object item) { if (item == null) { ZigZag.Serialize(stream, 1U); return; } var id = map.ToUInt32(item.GetType()) << 1; ZigZag.Serialize(stream, id); serializer.Get(item.GetType()).Serialize(stream, item); }
public EnumSerializer(Serializers s, Type type) { this.type = type; this.underlying = Enum.GetUnderlyingType(type); this.serializer = s.Get(underlying); }