I wrote a for-loop that inside of it I declared a new Image, so should I Dispose it every time inside the internal for-loop, or once it is all finished, and what's the difference?
Here's an example to make things clear, Should I use this:
for (int i = 0; i < 10; i++)
{
Image imgInput = new Image();
for (int j = 0; j < 100; j++)
{
// Here is a code to use my image
Image.Dispose();
}
}
OR:
for (int i = 0; i < 10; i++)
{
Image imgInput = new Image();
for (int j = 0; j < 100; j++)
{
// Here is a code to use my image
}
Image.Dispose();
}