public static IList <KeyValuePair <Guid, IList <int> > > Decode(FrameIterator iterator) { var listV = ListMultiFrameCodec.Decode(iterator, ListIntegerCodec.Decode); var listK = ListUUIDCodec.Decode(iterator); var result = new List <KeyValuePair <Guid, IList <int> > >(listK.Count); for (var i = 0; i < listK.Count; i++) { result.Add(new KeyValuePair <Guid, IList <int> >(listK[i], listV[i])); } return(result); }
public static void Encode(ClientMessage clientMessage, ICollection <KeyValuePair <Guid, ICollection <int> > > collection) { var keyList = new List <Guid>(collection.Count); clientMessage.Add(BeginFrame.Copy()); foreach (var kvp in collection) { keyList.Add(kvp.Key); ListIntegerCodec.Encode(clientMessage, kvp.Value); } clientMessage.Add(EndFrame.Copy()); ListUUIDCodec.Encode(clientMessage, keyList); }