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