FileStream fileStream = new FileStream(@txtPath.Text, FileMode.Open);
//txtPath.Text是文件路径
string fileName = fileStream.Name.Substring(
fileStream.Name.LastIndexOf("\\") + 1);
//获取包含扩展名的文件名
string aLastName = fileStream.Name.Substring(
fileStream.Name.LastIndexOf(".") + 1);
//获取扩展名
string Name=fileStream.Name.Substring(
fileStream.Name.LastIndexOf("\\") + 1
, fileStream.Name.LastIndexOf(".")
- fileStream.Name.LastIndexOf("\\") - 1);
//获取不包含扩展名的文件名
//txtPath.Text是文件路径
string fileName = fileStream.Name.Substring(
fileStream.Name.LastIndexOf("\\") + 1);
//获取包含扩展名的文件名
string aLastName = fileStream.Name.Substring(
fileStream.Name.LastIndexOf(".") + 1);
//获取扩展名
string Name=fileStream.Name.Substring(
fileStream.Name.LastIndexOf("\\") + 1
, fileStream.Name.LastIndexOf(".")
- fileStream.Name.LastIndexOf("\\") - 1);
//获取不包含扩展名的文件名