并行程序的一点注意事项
2010-08-03 12:15
253 查看
这几天无事,把自己以前写的一套CMS程序拿来改改,想用parallel.foreach来提高生成HTML的效率
模版解析类就没动,直接把以前的for循环改成parallel.foreach,就出现了未将对象引用设置到对象实例的错误,查找了半天,才发现问题出现在模版解析类的加载模版里
代码
模版解析类就没动,直接把以前的for循环改成parallel.foreach,就出现了未将对象引用设置到对象实例的错误,查找了半天,才发现问题出现在模版解析类的加载模版里
代码
public static string MapPath(string strPath) { if (HttpContext.Current != null) { return HttpContext.Current.Server.MapPath(strPath); } else //非web程序引用 { strPath = strPath.Replace("/", "\\"); if (strPath.StartsWith("\\")) { //strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\'); strPath = strPath.TrimStart('\\'); } return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath); } }
相关文章推荐
- Visual Studio2017中编写ASP.NET程序时使用C# 7.0元组Tuple新特性的一点注意事项
- x64位windows上程序开发的注意事项
- 几个DSP高手的经验介绍,编写基于DSP程序的注意事项
- 关于dijit.form.Select中addOption()的一点注意事项
- 程序注意事项
- 写串口程序的注意事项
- 在WEB程序中使用.NET Remoting的IpcChannel时注意事项(关于“拒绝访问”问题的解决)
- 程序从MYSQL迁移ORACLE注意事项之一
- [WP]WindowsPhone7团购小程序5-提交AppHub 的审核中注意事项
- c#程序开发中几个注意事项
- 编写基于DSP程序的注意事项
- 改 c 程序笔记_2_申请指针的注意事项
- java-编写跨平台Java程序注意事项
- 关于打包winfrom 程序的注意事项
- 使用程序内购买(IAP)的应用程序在提交时的注意事项,防止审核被拒
- 【并行计算-CUDA开发】GPGPU OpenCL/CUDA 高性能编程的10大注意事项
- Treepanel和Tabpanel搭配的一点注意事项
- 微信小程序学习---view-scroll的使用注意事项
- 在程序中使用自定义控件的自定义属性注意事项
- VFP开发Dcom程序的注意事项