public static void EncodeNullable <T>(ClientMessage clientMessage, IEnumerable <T> collection, Action <ClientMessage, T> encodeFunction) { if (collection == null) { clientMessage.Add(NullFrame.Copy()); } else { Encode(clientMessage, collection, encodeFunction); } }
public static void EncodeNullable <TKey, TValue>(ClientMessage clientMessage, IDictionary <TKey, TValue> map, Action <ClientMessage, TKey> encodeKey, Action <ClientMessage, TValue> encodeValue) { if (map == null) { clientMessage.Add(NullFrame.Copy()); } else { Encode(clientMessage, map, encodeKey, encodeValue); } }
public static void EncodeContainsNullable <T>(ClientMessage clientMessage, IEnumerable <T> collection, Action <ClientMessage, T> encodeFunction) { clientMessage.Add(BeginFrame.Copy()); foreach (var item in collection) { if (item == null) { clientMessage.Add(NullFrame.Copy()); } else { encodeFunction(clientMessage, item); } } clientMessage.Add(EndFrame.Copy()); }