Delete file (specify path)

From , 4 Years ago, written in C#, viewed 228 times.
URL https://pastebin.vip/view/40c48dab
  1. /// <summary>
  2. /// 指定路径删除文件
  3. /// 注意:文件的删除要求指定路径文件必须存在
  4. /// </summary>
  5. /// <param name="strPath">路径</param>
  6. public void deleteMyFile ( string strPath )
  7. {
  8.         if ( File.Exists ( strPath ) )
  9.         {
  10.                 File.Delete ( strPath );
  11.                 MessageBox.Show ( "删除成功!" );
  12.         }
  13.         else
  14.         {
  15.                 MessageBox.Show ( "要删除文件不存在!" );
  16.         }
  17. }
  18.  

Reply to "Delete file (specify path)"

Here you can reply to the paste above

captcha

↑↑↑↑↑↑↑↑↑↑↑↑↑ vps