Class public shared Variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Posted in asp.net newsgroup, no answer. Hope some experts can help me here

1. Does class shared variable share same feathers as ASP.NET application variable?

2. If it is, it may work better than application variables, because we don't need type conversion

3. Can web farm share same class shared variable? This is not critical for my case, just curious

4. I want to declare a ReaderWriterLock object for thread synchronization, should I declare it as public shared variable in a class, or an application variable

5. If I declare a public variable as Hash Table, I can put all my Thread Related objects into it. So I can create a new Thread, or Abort a thread any time. Is that correct?
 
Qingdong Z. said:
Posted in asp.net newsgroup, no answer. Hope some experts can help me here.

1. Does class shared variable share same feathers as ASP.NET application
variable?

Static/Shared variables are shared amongst all instances of the app, session
variables are unique to the session.
2. If it is, it may work better than application variables, because we
don't need type conversion.
Memory allocation is also different. However the type of the session
variable is what it is, all you need to do is cast it to its type which
AFAIK isn't resource instensive
3. Can web farm share same class shared variable? This is not critical for my case, just curious.

4. I want to declare a ReaderWriterLock object for thread synchronization,
should I declare it as public shared variable in a class, or an application
variable?
5. If I declare a public variable as Hash Table, I can put all my Thread
Related objects into it. So I can create a new Thread, or Abort a thread any
time. Is that correct?
 
Back
Top