c# wince 获取程序当前路径

using System;

using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;

namespace Austec.ToolCollection
{
    public class App
    {

       // 获取程序当前路径
        public static string GetPath()
        {
            string fullAppName = Assembly.GetExecutingAssembly().GetName().CodeBase;
            string fullAppPath = Path.GetDirectoryName(fullAppName);
            if (fullAppPath.StartsWith("file:"))
            {
                fullAppPath = fullAppPath.Substring(6);
            }
            if ( fullAppPath.Substring(fullAppPath.Length-1,1)!="//")
            {
                fullAppPath += "//";
            }
            return (fullAppPath);
        }
    }
}


你可能感兴趣的:(c# wince 获取程序当前路径)