Saving a Dictionary<int, object> in C# - Serialization?
<p>I have a dictionary in c#</p>

<pre><code>private Dictionary&lt;int, UserSessionInfo&gt; userSessionLookupTable = new Dictionary&lt;int, UserSessionInfo&gt;();
</code></pre>

<p>Now I have created a dictionary object </p>

<pre><code>this.userSessionLookupTable.Add(userSessionInfoLogin.SessionId, userSessionInfoLogin);
</code></pre>

<p>Now I want a generic method to serialize and de-serialize the dictionory to byte array.
Like </p>

<pre><code>public static void Serialize(Dictionary&lt;int, object&gt; dictionary, Stream stream)
{
 //Code here
}
</code></pre>

<p>and</p>

<pre><code>public static static Dictionary&lt;int, object&gt; Deserialize(Stream stream)
{
 //Code here
}
</code></pre>

<p>Can anyone help me on this??</p>