public void WriteCollection <TValue>(ICollection <TValue> collection) { var writeMethod = WriteMethods <TValue> .Get(); ulong token; if (writeCache.TryGetValue(collection, out token)) { Write(token); } else { token = (ulong)writeCache.Count + 1; writeCache.Add(collection, token); Write(token); Write(collection.GetType()); using (var writer = new Serializer(this)) { foreach (var value in collection) { writeMethod(writer, value); } } } }
public void WriteEnum <T>(T value) { WriteMethods <T> .Get()(this, value); }