如何通过.NET Compact Framework 1.x获取SD卡路径?
usingSystem.Collections;usingSystem.IO;
publicstaticstring[]GetStorageCardPath()
{
ArrayListtmpSDPath=newArrayList();
System.IO.FileAttributesfa=FileAttributes.Directory|FileAttributes.Temporary;
System.IO.FileSystemInfofsi;
System.IO.DirectoryInforootDir=newDirectoryInfo("//");
for(inti=0;i<rootDir.GetDirectories().Length;i++)
{
fsi=rootDir.GetDirectories();
if((fsi.Attributes&fa)==fa)
{
tmpSDPath.Add(fsi.FullName);
}
}
return(string[])tmpSDPath.ToArray(typeof(string));
}
本文地址:http://www.45fan.com/dnjc/73334.html