Click here to Skip to main content
15,867,568 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick

No More Session Variable Misspellings

Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
22 Jun 2011CPOL 8.5K   4
I prefer to wrap my session variables like this:public class MySession { public string MyValue { get { return Convert.ToString(Session["MyValue"]); } set { Session["MyValue"] = value; } }}

I prefer to wrap my session variables like this:


C#
public class MySession {
  public string MyValue
  {
     get { return Convert.ToString(Session["MyValue"]); } 

     set { Session["MyValue"] = value; }
  }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Unknown
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalcool dude :) Pin
Patalancha-Sagar27-Jun-11 19:09
Patalancha-Sagar27-Jun-11 19:09 
GeneralReason for my vote of 4 yes i used to the same Pin
pankajupadhyay2923-Jun-11 1:02
professionalpankajupadhyay2923-Jun-11 1:02 
Generalyes i used to the same Pin
pankajupadhyay2923-Jun-11 1:02
professionalpankajupadhyay2923-Jun-11 1:02 
GeneralSee my alternate. It is like your alternate, except a few th... Pin
AspDotNetDev22-Jun-11 14:39
protectorAspDotNetDev22-Jun-11 14:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.