C# WinCE下获取存储卡(SD卡)路径的最简单的办法

private static string GetStorageCard()
        {
           
            string firstCard = "";

            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("\\");

            System.IO.FileSystemInfo[] fsi = di.GetFileSystemInfos();            
           
            for (int x = 0; x < fsi.Length; x++)
            {
                
                if ((fsi[x].Attributes & System.IO.FileAttributes.Temporary) == System.IO.FileAttributes.Temporary)
                {
                    //if so, return the path
                    firstCard = fsi[x].FullName;
                }
            }

            return firstCard;
        }

你可能感兴趣的:(String,C#,存储,Path,WinCE)