Is there a serializable generic Key/Value pair class in .NET?

前端 未结 10 1392
自闭症患者
自闭症患者 2020-11-29 01:59

I\'m looking for a key/value pair object that I can include in a web service.

I tried using .NET\'s System.Collections.Generic.KeyValuePair<> class, but it doe

10条回答
  •  囚心锁ツ
    2020-11-29 02:37

    Just define a struct/class.

    [Serializable]
    public struct KeyValuePair
    {
      public K Key {get;set;}
      public V Value {get;set;}
    }
    

提交回复
热议问题