/// <summary> /// Read dictionary returned by GET_ALL operation. /// </summary> /// <param name="reader">Reader.</param> /// <returns>Dictionary.</returns> private static IDictionary <TK, TV> ReadGetAllDictionary(PortableReaderImpl reader) { IPortableStream stream = reader.Stream; if (stream.ReadBool()) { int size = stream.ReadInt(); IDictionary <TK, TV> res = new Dictionary <TK, TV>(size); for (int i = 0; i < size; i++) { TK key = reader.ReadObject <TK>(); TV val = reader.ReadObject <TV>(); res[key] = val; } return(res); } return(null); }
/// <summary> /// Reads results of InvokeAll operation. /// </summary> /// <typeparam name="T">The type of the result.</typeparam> /// <param name="inStream">Stream.</param> /// <returns>Results of InvokeAll operation.</returns> private IDictionary <TK, ICacheEntryProcessorResult <T> > ReadInvokeAllResults <T>(IPortableStream inStream) { var count = inStream.ReadInt(); if (count == -1) { return(null); } var results = new Dictionary <TK, ICacheEntryProcessorResult <T> >(count); for (var i = 0; i < count; i++) { var key = Unmarshal <TK>(inStream); var hasError = inStream.ReadBool(); results[key] = hasError ? new CacheEntryProcessorResult <T>(ReadException(inStream)) : new CacheEntryProcessorResult <T>(Unmarshal <T>(inStream)); } return(results); }