Пример #1
0
 public override ConcurrentDictionary <TKey, TValue> ConvertFromSurrogate(ref ConcurrentDictionarySurrogate <TKey, TValue> surrogate)
 {
     if (surrogate.Values is null)
     {
         return(null);
     }
     else
     {
         // Order of the key-value pairs in the return value may not match the order of the key-value pairs in the surrogate
         return(new ConcurrentDictionary <TKey, TValue>(surrogate.Values));
     }
 }
Пример #2
0
 public override void ConvertToSurrogate(ConcurrentDictionary <TKey, TValue> value, ref ConcurrentDictionarySurrogate <TKey, TValue> surrogate)
 {
     if (value is null)
     {
         surrogate = default;
         return;
     }
     else
     {
         surrogate = new ConcurrentDictionarySurrogate <TKey, TValue>
         {
             Values = new Dictionary <TKey, TValue>(value)
         };
     }
 }