"Matias" <ma****@nospam.com> wrote in message
news:uK***************@TK2MSFTNGP14.phx.gbl...
Hi:
I need some help, about How can I define a GLOBAL Data type in ASP.net
proyect.
What kind of data type? You can just create a public class in a .cs (or .vb)
file:
MyType.cs:
public class MyType
{
private int _num;
public MyType() {}
public int Num
{
get {return _num;}
set {_num = value;}
}
}
In MyPage.aspx:
private MyType _mine = new MyType();
....
private void Page_Load(object sender, EventArgs e)
{
_mine.Num = 1;
}
private void Button_Click(object sender, EventArgs e)
{
int i = _mine.Num; // i is now 1
}
You can use the same type on a different page, or use multiple instances of
it on a single page, or whatever, just like it was any other data type.
John Saunders