标签:ar sp 文件 div log bs ef as new
第一次写博客练习下
1 定义个文件比较类
public class FilesNameComparerClass :IComparer<string>
{
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
private static extern int StrCmpLogicalW(string psz1, string psz2);
public int Compare(string x, string y)
{
return StrCmpLogicalW(x, y);
}
}
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
private static extern int StrCmpLogicalW(string psz1, string psz2);
2. 调用
DirectoryInfo di = new DirectoryInfo(filePath);
FileInfo[] fileList = di.GetFiles("*.*");
fileList = fileList.OrderBy(s1 => s1.Name,new FilesNameComparerClass()).ToArray();
标签:ar sp 文件 div log bs ef as new
原文地址:http://www.cnblogs.com/kekekexin/p/4120931.html