title: ASP.net Sessions, references or not?..and how to write a session holding a list?
body: <p>I have this property in my code:</p>
  
  <pre><code>public List&lt;TreeViewNodeContentHolder&gt; NodeContentHolder
      {
          get
          {
              if (Session["NodeContainerSession"] == null)
              {
                  var tempSessionVar = new List&lt;TreeViewNodeContentHolder&gt;();
                  Session["NodeContainerSession"] = tempSessionVar;
                  return (List&lt;TreeViewNodeContentHolder&gt;)Session["NodeContainerSession"];
              }
              else
                  return (List&lt;TreeViewNodeContentHolder&gt;)Session["NodeContainerSession"];
          }
      }
  </code></pre>
  
  <p>and the thing I want to achive is that I want to be able to add objects and linq-query the list/session.
  So basicly I whould like to be able to write something like:</p>
  
  <pre><code>NodeContentHolder.Add(new TreeViewNodeContentHolder{prop1=1,prop2=2});
  </code></pre>
  
  <p>I also want to be able to do this:</p>
  
  <pre><code>var someNode = NodeContentHolder.Where(e=&gt;e.prop1 == x).FirstOrDefault();
  </code></pre>
  
  <p>And then another question aswell..if I whould do the thing above this line...whould I then be able to update the object in the session by doing:</p>
  
  <pre><code>someNode.prop1 = 12345;
  </code></pre>
  
  <p>??</p>
  
  <p>Or whould I have to first "pull" the object and then remove it from the list/session and then add it back in to make sure that it gets updated?..</p>
  
  <p>Thanks in advance!</p>