I am doing an R&D with Dispose. I have a doubt in case of Forms on disposing the image resource.
namespace DisposeTry
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Image mimg = new Bitmap("repository.png"))
image1.Image = mimg;
}
}
}
I cannot use mimg.Dispose or enclose within 'using' for obvious reasons. The when and how to dispose this resource. please advise.