KeyValuePairProxy.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //#if !NO_GENERICS
  2. //using System.Collections.Generic;
  3. //namespace ProtoBuf
  4. //{
  5. // /// <summary>
  6. // /// Mutable version of the common key/value pair struct; used during serialization. This type is intended for internal use only and should not
  7. // /// be used by calling code; it is required to be public for implementation reasons.
  8. // /// </summary>
  9. // [ProtoContract]
  10. // public struct KeyValuePairSurrogate<TKey,TValue>
  11. // {
  12. // private TKey key;
  13. // private TValue value;
  14. // /// <summary>
  15. // /// The key of the pair.
  16. // /// </summary>
  17. // [ProtoMember(1, IsRequired = true)]
  18. // public TKey Key { get { return key; } set { key = value; } }
  19. // /// <summary>
  20. // /// The value of the pair.
  21. // /// </summary>
  22. // [ProtoMember(2)]
  23. // public TValue Value{ get { return value; } set { this.value = value; } }
  24. // private KeyValuePairSurrogate(TKey key, TValue value)
  25. // {
  26. // this.key = key;
  27. // this.value = value;
  28. // }
  29. // /// <summary>
  30. // /// Convert a surrogate instance to a standard pair instance.
  31. // /// </summary>
  32. // public static implicit operator KeyValuePair<TKey, TValue> (KeyValuePairSurrogate<TKey, TValue> value)
  33. // {
  34. // return new KeyValuePair<TKey,TValue>(value.key, value.value);
  35. // }
  36. // /// <summary>
  37. // /// Convert a standard pair instance to a surrogate instance.
  38. // /// </summary>
  39. // public static implicit operator KeyValuePairSurrogate<TKey, TValue>(KeyValuePair<TKey, TValue> value)
  40. // {
  41. // return new KeyValuePairSurrogate<TKey, TValue>(value.Key, value.Value);
  42. // }
  43. // }
  44. //}
  45. //#endif