C
Christ Kennedy
Guest
I've been reading an article(which I should do more often) and found the tilda character '~' confusing...
public class Render2JPG : FrameRenderer
{
public Render2JPG(string img1, string img2)
{
g = null;
g2 = null;
bmp = null;
bmp2 = null;
jpg1 = new Bitmap(img1, true);
jpg2 = new Bitmap(img2, true);
}
~Render2JPG() // <-------- what does the '~' do?
{
jpg1.Dispose();
jpg2.Dispose();
bmp.Dispose();
bmp2.Dispose();
g.Dispose();
g2.Dispose();
}
what does the '~' do. By the content of the code block that follows that line I'm assuming this is executed when the object is disposed?
my code is perfect until i don't find a bug
Continue reading...
public class Render2JPG : FrameRenderer
{
public Render2JPG(string img1, string img2)
{
g = null;
g2 = null;
bmp = null;
bmp2 = null;
jpg1 = new Bitmap(img1, true);
jpg2 = new Bitmap(img2, true);
}
~Render2JPG() // <-------- what does the '~' do?
{
jpg1.Dispose();
jpg2.Dispose();
bmp.Dispose();
bmp2.Dispose();
g.Dispose();
g2.Dispose();
}
what does the '~' do. By the content of the code block that follows that line I'm assuming this is executed when the object is disposed?
my code is perfect until i don't find a bug
Continue reading...