ProgressBar pBar = new ProgressBar(obj);
if(_FileRead!=false)
{
pBar.Text = langSupport.GetMessages("123", cultureName);
pBar.ShowDialog();
}
In this example how I can dispose “pBar” resource. Below I have specifide 3 ways, which is the best way of object dispose?
pBar.Dispose();pBar = null;pBar.Dispose();
pBar = null;
Wrap the creation of the
ProgressBarin ausingstatement.Since it implements
IDisposable, this is the best way to ensure proper disposal.