Hi, I come from a C/C++ background and am having trouble doing some things in C#. My problem right now is that I need a static
keyword that works like in C++. So that the property is global to all instances of the class, which is what C#'s does. But what I don't want is the persistence in C#(/ASP.NET). I want the static property global to all instances of a class on the currently executing page only.
How can it be possible to do this?
Basically what I'm using this for is unique naming which must only be unique on the currently executing page. If the static property is persistent, then there is a much higher chance of integer rollover in periods of high traffic, which could lead to the same value being used twice.
Like if someone went to a page with
static int i=0;
page_load...{
lbl.Text=i;
i++;
}
then they would get 0. and if someone else went to the same page they would also get 0. But also having the static property so that it's the same in all instances of the class.