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

.NET Compact Framework中Directory.GetCurrentDirectory()方法在Windows CE上不被支持,文章介绍了一种替代方案,使用System.IO.Path.GetDirectoryName()结合System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase属性来获取当前运行文件的目录。

问题

.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 MethodAssemblyName.CodeBase Property 来代替。

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

转载于:https://www.cnblogs.com/procoder/archive/2009/07/29/Windows_Mobile_Compact_Framework_Path.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值