C#:Dispose()方法调用Bitmap.save后Bitmap对象()?
问题描述:
我有这样的:
Bitmap bmp = new Bitmap(image);
//image processing
bmp.Save(path + fileName);
和我想知道如果我需要 bmp.Dispose()
在此之后code调用。
先谢谢了。
and I want to know if I need to call bmp.Dispose()
after this code.
Thanks in advance.
答
我会使用使用
块和 Path.Combine
using(var bmp = new Bitmap(image))
{
// image processing
bmp.Save(Path.Combine(path ,fileName));
}