その名前とそれを含むフォルダーを含むファイルを削除したい。私が名前を言うとき、私は拡張子なしを意味します。
これが私が知っている方法です。(あなたの少しの助けで、それはうまくいきます)
//the extension string doesn't work properly.Here I need your help
string extension = Path.GetExtension(@"C:\Projects_2012\Project_Noam\Files\ProteinPic" + comboBox1.SelectedItem.ToString());
string fileLoc = @"C:\Projects_2012\Project_Noam\Files\ProteinPic\" + comboBox1.SelectedItem.ToString() + extension;
if (File.Exists(fileLoc))
{
File.Delete(fileLoc);
}