我知道通常有一个简单的解决方案,它在引用中引用了dll.但是我添加了引用,system.runtime.caching出现在我的引用列表中,但仍然显示错误.
错误在运行时显示在浏览器中,因此它会进行编译.
我已删除并重新添加了引用但仍然没有运气.我已重启VS 2012并重新启动.
Visual Studio 2012 .net框架4.5
截屏:
public interface IMovable
{
void Move();
}
public interface IUnloadable
{
void Unload();
}
public class Vehicle : IMovable
{
public void Move()
{
Console.Write("moving");
}
}
public class Truck : IMovable, IUnloadable
{
private Vehicle Veh;
public Truck(Vehicle veh)
{
this.Veh = veh;
}
public void Move()
{
Veh.Move();
Console.Write("reverse with beepy noise as well");
}
public void Unload()
{
Console.Write("Unload");
}
}
Run Code Online (Sandbox Code Playgroud)
如果这是装饰模式.装饰者模式和构图之间有什么区别?我已经看到了使用继承的这种模式的例子.例如维基百科上的Java示例.
我根本没有看到需要使用继承,或者我错过了什么?
我已尝试此线程上的所有解决方案: .NET 3.5图表控件异常:执行ChartImg.axd的子请求时出错
我加了
<add
path="ChartImg.axd"
verb="GET,HEAD"
type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
Run Code Online (Sandbox Code Playgroud)
该httpHandlers
部分的代码,但它仍然无法正常工作.
我还补充说:
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
<httpHandlers>
...
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
...
</httpHandlers>
<handlers>
...
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
...
</handlers>
Run Code Online (Sandbox Code Playgroud)
但是在争取一段时间将这些标签放在配置文件中的正确位置后,我得到了同样的错误.
这是我目前的配置文件:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
<system.web> …
Run Code Online (Sandbox Code Playgroud) 我知道在这里已经多次询问过这种事情,但我仍然没有完全理解ASP中的线程安全性.
C#:Where Util是一个静态类,而List是一个静态List.
Util.theList= new List<Object>();
Util.theList.Add(someObject);
Run Code Online (Sandbox Code Playgroud)
页面加载一次,然后一秒钟后(POSTACK后1秒)填充Util.theList并重新加载页面以与新填充的列表数据绑定:
this.Repeater.DataSource = Util.theList;
this.Repeater.DataBind();
Run Code Online (Sandbox Code Playgroud)
每次填充List时,它都是INSTANTIATED:
Util.theList= new List<Object>();
Run Code Online (Sandbox Code Playgroud)
如果这不是线程安全的,我怎样才能使其线程安全?我不能让列表非静态并且在同一页面上,因为一个单独的问题,如果数据绑定在page_load上,数据每次都会绑定: OnDataBind只在第一次回发时触发