Click here to Skip to main content
15,891,864 members
Articles / Programming Languages / C#

Windows Mobile Programming Tricks on the .NET Compact Framework: Part 1

Rate me:
Please Sign up or sign in to vote.
4.64/5 (8 votes)
23 Feb 2011CPOL4 min read 41K   668   24  
The article provides and describes some useful code snippets for Windows Mobile/CE developers.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace BeeMobile
{
    public class StorageCardInfo
    {
        /// <summary>
        /// Returns the list of Storage Card names. A localized (e.g. Chinese) device can have different name than "Storage Card".
        /// </summary>
        /// <returns>The list of Storage Card names.</returns>
        static public List<string> GetStorageCardNames()
        {
            DirectoryInfo rootInfo = new DirectoryInfo("\\");
            List<string> paths = new List<string>();

            foreach (DirectoryInfo dirInfo in rootInfo.GetDirectories())
            {
                if ((dirInfo.Attributes & FileAttributes.Temporary) != 0)
                {
                    //Debug.WriteLine("Directory Name: " + dirInfo.Name)
                    //Debug.WriteLine("     Full Name: " + dirInfo.FullName)
                    paths.Add(dirInfo.FullName);
                }
            }

            return paths;

        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
G&M Dynamics, s.r.o.
Slovakia Slovakia
I work for Bee Mobile.

Web site: http://beemobile4.net
Facebook site: http://facebook.com/BeeMobile
YouTube Channel: http://youtube.com/beemobile4dotnet

Comments and Discussions