title: Is it possible to have a compile time check that a type is marked with the Serializable attribute
body: <p>Specifically we're making our application compatible with the Out Of Process Session State server where all types saved in session must be serializable.  </p>
  
  <p>Is there a way to see at compile time that any type put into HttpSessionState is marked with the Serializable attribute.  Something along the lines of this 'non-valid' code</p>
  
  <pre><code>public static void Put&lt;T&gt;( string key, T value ) where T : IsMarkedWitheSerializableAttribute
  {
     HttpContext.Current.Session[key] = value;
  }
  </code></pre>