如何确定文件系统是否是区分大小写的。NET? [英] How do I determine whether the filesystem is case-sensitive in .net?
本文介绍了如何确定文件系统是否是区分大小写的。NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.NET是否有一种方式来确定本地文件系统是否区分大小写?
Does .net have a way to determine whether the local filesystem is case-sensitive?
推荐答案
您可以创建临时文件夹中的文件(使用小写的文件名),然后检查文件是否存在(使用大写的文件名),例如:
You can create a file in the temp folder (using lowercase filename), then check if the file exists (using uppercase filename), e.g:
string file = Path.GetTempPath() + Guid.NewGuid().ToString().ToLower();
File.CreateText(file).Close();
bool isCaseInsensitive = File.Exists(file.ToUpper());
File.Delete(file);
这篇关于如何确定文件系统是否是区分大小写的。NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文