Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have a class let's call it "ThisClass" that has a boolean shared property named "Iseethis" that I set to "True" when certain users login. Does windows "destroy" this when the user leaves the website or is it something I'll need to handle in the code?
Posted

Ummm! Are you sure about that? That's what I thought but if I go to another page after setting the value and do something like

 

 

 

dim x as string

 

x = ThisClass.Iseethis

 

it returns the value I set it to on the opening page.

Posted

Of course it is not destroyed. You are talking about shared variables.

 

Shared variables relate to a class and not to an instance of that class. Thus as long as the class is there, so they are.

 

Any members of the class relating to an instance (example public variables..) are destroyed once their instance is.

 

Hope this helps,

Dream as if you'll live forever, live as if you'll die today
Posted
Its not that but you should not use shared variables for user specific purposes, Shared variables as their name states are shared between all instances of the class.
Dream as if you'll live forever, live as if you'll die today

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...