在Windows Mobile和Wince(Windows Embedded CE)下使用.NET Compact Framework 取当前运行文件的路径

问题

.NET Compact Framework 提供了Directory.GetCurrentDirectory Method 取当前运行文件的目录,可是运行的时候会抛出 NotSupportedException 。

这个问题MSND的解释如下:

The operating system is Windows CE, which does not have current directory functionality.

This method is available in the .NET Compact Framework, but is not currently supported.

 

替代方案

使用 Path.GetDirectoryName Method 和 AssemblyName.CodeBase Property 来代替。

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);



本文转自Jake Lin博客园博客,原文链接:http://www.cnblogs.com/procoder/archive/2009/07/29/Windows_Mobile_Compact_Framework_Path.html,如需转载请自行联系原作者


上一篇:扩展htmlhelper.DropDownListFor 支持list数据源和option增加属性


下一篇:Flutter之运行提示Could not update files on device: Connection closed before full header was received