title: Add to generic List property and save in viewstate
body: <p>I'm using a generic List to store a set of data in the viewstate. If I try sorting the list using linq in the get accessor then when I try to add a new item to the list if doesn't work. No error, it just doesn't add it to the list.</p>
  
  <p>When I run this line of code:</p>
  
  <pre><code>MyObjectList.Add(new MyObject());
  </code></pre>
  
  <p><br /><br />
  using this property doesn't work:</p>
  
  <pre><code>public List&lt;MyObject&gt; MyObjectList
  {
     get
     {
        if (ViewState["MyObjectList"] == null)
           ViewState["MyObjectList"] = GetDataFromDataBase();
        return ((List&lt;MyObject&gt;)ViewState["MyObjectList"]).OrderBy(x =&gt; x.MyObjectID).ToList();
     }
  }
  </code></pre>
  
  <p><br /><br />
  but using this property does (although now I have to sort every time after getting):</p>
  
  <pre><code>public List&lt;MyObject&gt; MyObjectList
  {
     get
     {
        if (ViewState["MyObjectList"] == null)
           ViewState["MyObjectList"] = GetDataFromDataBase();
        return (List&lt;MyObject&gt;)ViewState["MyObjectList"];
     }
  }
  </code></pre>
  
  <p><br /><br />
  How am I supposed to sort the data in the get accessor?</p>