Tech Off Post

Single Post Permalink

View Thread: is 'new object().property' or 'new object().method()' a good idea?
  • User profile image
    evildictait​or

    littleguru wrote:
    

    I'm accessing a private member of the class in the DoIt method. How can the GC collect the instance that is holding that before I access it. I thought the GC is only collecting if the instance is no longer reachable!

    Correct me if I'm wrong!


    Turns out this is only happens when interacting with PInvoke and unmanaged operations. Within managed code it doesn't happen.

    Read Dino's post.