Results 1 to 4 of 4

Thread: New Immediate Window session?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    New Immediate Window session?

    How do you start a new session? Like if I was to type in

    Code:
    Class a = new Class1();
    How do I clear "a" and the rest of the variables from the scope?

  2. #2
    Hyperactive Member vbcode1980's Avatar
    Join Date
    Nov 2005
    Location
    Anywhere the wind blows
    Posts
    365

    Re: New Immediate Window session?

    To clear your class you can simply type
    Code:
    a = null;
    Beware that even though you've 'nullified' it, it won't be really gone until the garbage collector has disposed of it. That won't be a problem for your application though.

    But what do you mean with 'start a new session'?
    I code C#....

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,348

    Re: New Immediate Window session?

    Quote Originally Posted by vbcode1980 View Post
    what do you mean with 'start a new session'?
    I believe he means to close the current scope and open a new one. In normal code you declare a variable and it exists only within the block it's declared in. Once that block ends the variable ceases to exist. In the case of the Immediate window I don't believe that there's any way to force a variable that you've declared out of scope. I've never seen it done and I couldn't find any indication that it's possible in my own reading. That doesn't mean that it's not possible but they've hidden it pretty well if it is.

    Interestingly, I wonder what happens if you declare a variable in the Immediate window and then a variable with the same name comes into scope as you step through your code. If you get the value of the variable with that name, which one will you get. Might check that out tomorrow, or today as it's 12:42 AM. Best off to sleeps.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,547

    Re: New Immediate Window session?

    Hm, Building the project (even if it is up to date) seems to do it. Although hoping there is a better way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width