JJ,
This depends. If it is a local variable, then it might not. If the
variable is not passed to anything and not referenced further in the
procedure, then the CLR might determine that it is not accessible and make
it eligible for garbage collection.
However, this is digressing. For what you want to do, you probably want
to expose whatever value/property/object you want using a static property.
You can make a static property/field and that will last for the lifetime of
the application.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"JJ" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Hi All,
I was wondering if I create an object in public main
does it persist for the lifetime of the app? If not where
do u create objects that will persist for the lifetime of
app so that when I call a method in a class I can
reference that object? By the way I am creating a win
form app in c#.
Thanks,
JJ