类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
在FileStream的构造函数和File.Exists方法中均不能使用相对路径指定文件,另外运行Directory.GetCurrentDirectory得到NotSupportedException异常,请问这是怎么回事?我使用.net compact framework(sp2),在PPC2003上调试.
网友回答:
第一个不知道,第二个,CE不支持GetCurrentDirectory方法,该方法只是为了与桌面兼容才存在的。你可以看msdn这个连接中,remarks最下面那行:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiodirectoryclassgetcurrentdirectorytopic.asp
你可以这么做:
using System.Reflection;
using System.IO;
// This is the full directory and exe name
String fullAppName = Assembly.GetExecutingAssembly().GetName().CodeBase;
// This strips off the exe name
String fullAppPath = Path.GetDirectoryName(fullAppName);
你啊.用PPC开发.早就应该预料到这些问题的了.
好好看他的SDK的文档资料