By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,419 Members | 996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,419 IT Pros & Developers. It's quick & easy.

What is the life expectancy of static hashtable

P: n/a
Using ASP.net, C# and a static class, does the following from MSDN mean:

1. a static hashtable would only live during the session and end when the
session ends

2. there would be a different static hashtable for each session
++ from MSDN ++

Static Variables - Lifetime

Extension of Lifetime
If a local variable is declared with the Static keyword, its lifetime is
longer than the execution time of the procedure in which it is declared. If
the procedure is inside a module, the static variable survives as long as
your application continues running.

If a static variable is declared in a procedure inside a class, the
variable's lifetime depends on whether the procedure is shared. If the
procedure is declared with the Shared keyword, the variable's lifetime
continues until your application terminates. If the procedure is nonshared,
its static variables are instance members of the class, and their lifetimes
are the same as that of the class instance.
++ end ++
Thank you,

John
May 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
No. There will be one static hashtable across all sessions until the
application terminates.

Eliyahu

"xzzy" <mr********@comcast.net> wrote in message
news:ne******************************@comcast.com. ..
Using ASP.net, C# and a static class, does the following from MSDN mean:

1. a static hashtable would only live during the session and end when
the
session ends

2. there would be a different static hashtable for each session
++ from MSDN ++

Static Variables - Lifetime

Extension of Lifetime
If a local variable is declared with the Static keyword, its lifetime is
longer than the execution time of the procedure in which it is declared.
If
the procedure is inside a module, the static variable survives as long as
your application continues running.

If a static variable is declared in a procedure inside a class, the
variable's lifetime depends on whether the procedure is shared. If the
procedure is declared with the Shared keyword, the variable's lifetime
continues until your application terminates. If the procedure is
nonshared,
its static variables are instance members of the class, and their
lifetimes
are the same as that of the class instance.
++ end ++
Thank you,

John

May 21 '06 #2

P: n/a
And remember, this is in dog years.

--
;-),

Kevin Spencer
Microsoft MVP
Professional Numbskull

The man who questions opinions is wise.
The man who quarrels with facts is a fool.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:Ol****************@TK2MSFTNGP02.phx.gbl...
No. There will be one static hashtable across all sessions until the
application terminates.

Eliyahu

"xzzy" <mr********@comcast.net> wrote in message
news:ne******************************@comcast.com. ..
Using ASP.net, C# and a static class, does the following from MSDN mean:

1. a static hashtable would only live during the session and end when
the
session ends

2. there would be a different static hashtable for each session
++ from MSDN ++

Static Variables - Lifetime

Extension of Lifetime
If a local variable is declared with the Static keyword, its lifetime is
longer than the execution time of the procedure in which it is declared.
If
the procedure is inside a module, the static variable survives as long as
your application continues running.

If a static variable is declared in a procedure inside a class, the
variable's lifetime depends on whether the procedure is shared. If the
procedure is declared with the Shared keyword, the variable's lifetime
continues until your application terminates. If the procedure is
nonshared,
its static variables are instance members of the class, and their
lifetimes
are the same as that of the class instance.
++ end ++
Thank you,

John


May 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.