【发布时间】:2012-03-30 11:43:12
【问题描述】:
我正在尝试从 Silverlight 应用程序中的 .Web 项目中获取 ClientBin 目录的路径。目前,我的方法看起来像这样,但必须有更好/更简洁的方法来获取这条路径:
public static string GetClientBinPath()
{
var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
if (applicationPath.StartsWith(@"file:\"))
applicationPath = applicationPath.Remove(0, 6);
applicationPath = Path.Combine(applicationPath, @"..\ClientBin");
return applicationPath;
}
【问题讨论】:
标签: c# asp.net silverlight silverlight-4.0