title: Object not disposed after calling the Dispose() function
body: <p>I have query regarding the disposing of an object. The scenario is as follows.</p>
  
  <p>In a Desktop Appication, developed in C#, I have a function in which a object in created like this.</p>
  
  <pre><code>namespace Class 1
  {
      variables section;
      ....
      ....
  
      Function1()
      {
           local variables;
           try
           {
                Object1 obj = new Object1();
                ....
                ....
                if(true)
                {
                    ....
                }
                else
                {
                     **obj.Dispose();**
                }
            }
            catch()
            {}
            finally
            {}
       }
  }
  </code></pre>
  
  <p>The object is not disposed when the else part is executed. The msdn link for this is </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.component.dispose(VS.90).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.componentmodel.component.dispose(VS.90).aspx</a></p>
  
  <p>according to which the component should realase all the resources used by it.</p>
  
  <p>I would like to know, why the object is not disposed.</p>
  
  <p>Thank you.</p>
  
  <p>Pavan Navali.    </p>