c#获取运行路径(wince&xp)

来源:互联网 发布:好域名的七大特点 编辑:程序博客网 时间:2024/06/05 15:06
        private static string m_CurrentPath;
        private static string Platform
        {
            get
            {
                return Environment.OSVersion.Platform.ToString();
            }
        }

        /// <summary>
        /// 获取运行路径
        /// </summary>
        public static string CurrentPath
        {
            get
            {
                if (Platform.Equals("WinCE"))
                {
                    m_CurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

                }
                else if (Platform.Equals("Win32NT"))
                {
                    m_CurrentPath = Directory.GetCurrentDirectory();
                }

                return m_CurrentPath;
            }
        }
原创粉丝点击