62,046
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<A> o = null;//new List<A>();
if (HttpRuntime.Cache["MyList"] == null)
{
o = new List<A>();
o.Add(new A() { obj = new object() });
HttpRuntime.Cache.Insert("MyList", o, null, DateTime.Now.AddSeconds(100), System.Web.Caching.Cache.NoSlidingExpiration,);
}
else
{
o = (List<A>)HttpRuntime.Cache["MyList"] ;
}
}
}
public class A
{
public object obj { get; set; }
}
}