string path =@"C:\hello\yinyue.mp3";
string name = Path.GetFileName(path);

解决方案 »

  1.   

    不必使用查找截串,就使用 Path.GetFileName就可以得到文件名称了。代码如上。
      

  2.   

    string strpath = "C:\hello\yinyue.mp3";
    int posInt=strPath.LastIndexOf("\"); //最后一个\的位置
    string strName=strPath.Substring(posInt+1); //这个就是名字了
      

  3.   

    FileInfo info = new info(FileName);
    string name = info.Name
      

  4.   

    FileInfo info = new FileInfo(FileName); 
    string name = info.Name