Regarding dispose method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suja146
    New Member
    • Feb 2010
    • 1

    Regarding dispose method

    Hi. Can u pls explain this piece of code, line by line?

    Code:
    protected override void Dispose(bool disposing)
    {
       if (disposing)
       {
          if (components != null)
          {
             components.Dispose();
          }
       }
    base.Dispose(disposing);
    }
    Last edited by tlhintoq; Feb 7 '10, 03:33 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    The code is virtually English if you read it out loud. Is it causing an error?

    if disposing then run the code between the braces
    ....... if the components are not null, then runt he code between the braces
    ............... components, dispose (of them)

    base.Dispose - since this is an inherited method (since it is an override) - run the Dispose() method of the base class this was built upon

    Comment

    Working...