|
by moomi via Brain. Fruit. Code. on 2/2/2010 5:23:00 AM
Today I’ll present a tidy way to manage session objects without all the tedious checking for existence. The thought of seeing this in code makes me cringe:
if (Session["something"] == null)
{
Session["something"] = new Something();
}
Come on, man! If you have any kind of session objects, you’re going to do this once for every object. I’ve been using a session class extension that handles the default creation of objects in one line. The two methods of the Sessio
... [ read more ]
|