|
 |
aspx_beginners thread: How to declare variables?
Message #1 by "Matt Dittman" <mddittman@h...> on Mon, 19 Aug 2002 15:19:59
|
|
I am coding aspx pages using C#. This is my first use of the C#
language. Currently, I am declaring variables that I want to access
throughout the codebehind like this:
public class myClass: System.Web.UI.Page
{
string myString;
int myInt;
private void Page_Load(object sender, System.EventArgs e)
{
myString = "Hello World";
myInt = 5;
}
}
It works, but is this completely correct? Should I be preceding
the 'string' or 'int' declaration with something else, like 'protected'
or 'static' or something?
Thanks in advance,
Matt
Message #2 by "Payal Parija" <pparija@u...> on Mon, 19 Aug 2002 19:23:26
|
|
> I am coding aspx pages using C#. This is my first use of the C#
l> anguage. Currently, I am declaring variables that I want to access
t> hroughout the codebehind like this:
> public class myClass: System.Web.UI.Page
{>
> string myString;
> int myInt;
> private void Page_Load(object sender, System.EventArgs e)
> {
> myString = "Hello World";
> myInt = 5;
> }
> }
> It works, but is this completely correct? Should I be preceding
t> he 'string' or 'int' declaration with something else, like 'protected'
o> r 'static' or something?
> Thanks in advance,
> Matt
Message #3 by "Payal Parija" <pparija@u...> on Mon, 19 Aug 2002 19:24:06
|
|
u should have them as protected
|
|
 |