可以使用Path.GetFileName方法来获取文件名。以下是一个示例代码:

using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string filePath = @"C:\AA\C.TXT";
        string fileName = Path.GetFileName(filePath);
        
        Console.WriteLine("File Name: " + fileName);
    }
}

输出结果为:

File Name: C.TXT
c#在 CAACTXT路径中取文件名

原文地址: http://www.cveoy.top/t/topic/ij6w 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录