c# 删除一个bmp图像

来源:百度知道 编辑:UC知道 时间:2024/05/23 10:35:22
如何在程序中删除一个在计算机中指定位置的图像

if (File.Exists(Server.MapPath("~/") + picPath))
{
File.Delete(Server.MapPath("~/") + picPath);
}

//picPath是图片的相对地址,Server.MapPath("~/") 获得网站的物理路径。两者相加,就是图片的绝对路径

其实就是删除文件的,不用特定的说删除什么类型,只要有文件名,就删呗,呵呵。

using System.IO;
string path=@"C:\aaa.bmp";
File.Delete(string path);

File.Delete()不行么?