获取文件名(包括后缀)LastIndexOf应用,字符串处理

using System;
using System.Collections.Generic;
using System.Text;

namespace 获取文件名
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = @"c:\ss\b.txt";
          string ss=  s.Substring(s.LastIndexOf("\\") + 1);
            Console.WriteLine(ss);//输入结果b.txt
            Console.ReadKey();
        }
    }
}