c#中没有文件扩展名的文件类型 [英] File Type without File extension in c#
本文介绍了c#中没有文件扩展名的文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个名为Test.txt的文件。现在,如果我将该文件的扩展名更改为.xls。现在我的文件名是tset.xls而不是Test.txt。那我怎么知道那个文件的文件类型。
Suppose I have a file Name is "Test.txt". Now if I change the extension of that file to .xls. Now my file name is "tset.xls" instead of "Test.txt". Then how can I know the file type of that file.
推荐答案
参见: http://stackoverflow.com/questions/58510/using -net-how-you-you-the-mime-type-of-a-file-on-the-file-signature / 58570#58570 [ ^ ]
请检查此...
http://stackoverflow.com/questions/1437382/get-file-type-in-net [ ^ ]
please check this...
http://stackoverflow.com/questions/1437382/get-file-type-in-net[^]
您好
看你可以用这个
Hi
see you can use this
string p = @"C:\Test.txt";
string e = Path.GetExtension(p);
结果:e =txt
Result : e= "txt"
这篇关于c#中没有文件扩展名的文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文