Click here to Skip to main content
16,007,085 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionUnable to dispose of shared object Pin
mad_cow12-Jun-07 8:14
mad_cow12-Jun-07 8:14 
AnswerRe: Unable to dispose of shared object Pin
Guffa12-Jun-07 8:31
Guffa12-Jun-07 8:31 
GeneralRe: Unable to dispose of shared object Pin
mad_cow12-Jun-07 8:58
mad_cow12-Jun-07 8:58 
GeneralRe: Unable to dispose of shared object Pin
MidwestLimey12-Jun-07 9:33
professionalMidwestLimey12-Jun-07 9:33 
GeneralRe: Unable to dispose of shared object Pin
mad_cow12-Jun-07 9:49
mad_cow12-Jun-07 9:49 
GeneralRe: Unable to dispose of shared object Pin
MidwestLimey12-Jun-07 9:54
professionalMidwestLimey12-Jun-07 9:54 
GeneralRe: Unable to dispose of shared object Pin
mad_cow12-Jun-07 10:14
mad_cow12-Jun-07 10:14 
GeneralRe: Unable to dispose of shared object Pin
MidwestLimey12-Jun-07 10:30
professionalMidwestLimey12-Jun-07 10:30 
Nope. It might help to think of shared fields/methods etc as existing in a separate class that is by default a singleton.

Shared fields exist on this singleton object that is created once and only once per appdomain (an appdomain is a subsection of a process - can be considered synonymous with process for most situations). This singleton object is referenced via the class name i.e. Class1.fieldY or Class1.methodX() and is available anywhere in the appdomain, accessors (public, friend etc) permitting.

Any values set will persist until the appdomain is unloaded. In this case myVal will continue to increase with every call to GetInstance() until IIS is restarted.

You can create and destroy as many Class1 instances as you wish, it will have no bearing on the shared fields defined in Class1.

To determine if the current instance of Class1 is the same as the last, call cls1.GetHashCode() where cls1 is an instance of Class1. If the values are different then you have different instances.

------------------------------------------------
I'm largely language agnostic -

After a while they all bug me WTF | :WTF:
------------------------------------------------

GeneralRe: Unable to dispose of shared object Pin
mad_cow12-Jun-07 10:36
mad_cow12-Jun-07 10:36 
AnswerRe: Unable to dispose of shared object Pin
Guffa12-Jun-07 10:32
Guffa12-Jun-07 10:32 
GeneralRe: Unable to dispose of shared object Pin
mad_cow12-Jun-07 10:47
mad_cow12-Jun-07 10:47 
Questionlistitem in vb.net Pin
jds120712-Jun-07 8:06
jds120712-Jun-07 8:06 
AnswerRe: listitem in vb.net Pin
Tarakeshwar Reddy12-Jun-07 10:43
professionalTarakeshwar Reddy12-Jun-07 10:43 
Questiondb connection Pin
vishnu mohan12-Jun-07 6:46
vishnu mohan12-Jun-07 6:46 
AnswerRe: db connection [modified] Pin
WhiteGirl2312-Jun-07 19:24
WhiteGirl2312-Jun-07 19:24 
QuestionUDP - computer with 2 ip address Pin
pinhas12-Jun-07 6:06
pinhas12-Jun-07 6:06 
AnswerRe: UDP - computer with 2 ip address Pin
nlarson1112-Jun-07 8:03
nlarson1112-Jun-07 8:03 
GeneralRe: UDP - computer with 2 ip address Pin
pinhas12-Jun-07 21:04
pinhas12-Jun-07 21:04 
QuestionReader is closed Pin
Brendan Vogt12-Jun-07 4:14
Brendan Vogt12-Jun-07 4:14 
AnswerRe: Reader is closed Pin
ctlqt1212-Jun-07 5:34
ctlqt1212-Jun-07 5:34 
AnswerRe: Reader is closed Pin
WhiteGirl2312-Jun-07 19:30
WhiteGirl2312-Jun-07 19:30 
AnswerRe: Reader is closed Pin
koolprasad200312-Jun-07 19:54
professionalkoolprasad200312-Jun-07 19:54 
QuestionHow do I put user control in toolbox Pin
VFaul12-Jun-07 3:59
VFaul12-Jun-07 3:59 
AnswerRe: How do I put user control in toolbox Pin
nlarson1112-Jun-07 8:05
nlarson1112-Jun-07 8:05 
GeneralRe: How do I put user control in toolbox Pin
VFaul12-Jun-07 10:48
VFaul12-Jun-07 10:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.