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

前端 未结 10 1405
自闭症患者
自闭症患者 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:49

    You will find the reason why KeyValuePairs cannot be serialised at this MSDN Blog Post

    The Struct answer is the simplest solution, however not the only solution. A "better" solution is to write a Custom KeyValurPair class which is Serializable.

提交回复
热议问题