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

<p>I tried using .NET's <a href="http://msdn.microsoft.com/en-us/library/5tbh8a42.aspx" rel="noreferrer"><code>System.Collections.Generic.KeyValuePair&lt;&gt;</code></a> class, but it does not properly serialize in a web service. In a web service, the Key and Value properties are not serialized, making this class useless, unless someone knows a way to fix this.</p>

<p>Is there any other generic class that can be used for this situation?</p>

<p>I'd use .NET's <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.pair.aspx" rel="noreferrer"><code>System.Web.UI.Pair</code></a> class, but it uses Object for its types. It would be nice to use a Generic class, if only for type safety.</p>

Just define a struct/class.
```
```
[Serializable]
public struct KeyValuePair<K,V>
{
  public K Key {get;set;}
  public V Value {get;set;}
}
```
```