在VB.NET上我可以做这样的事情来写出缓存中的所有密钥:
Dim oc As HttpContext = HttpContext.Current
For Each c As Object In oc.Cache
oc.Response.Write(c.Key.ToString())
Next
Run Code Online (Sandbox Code Playgroud)
尽管.Key没有出现在Intellisense中,但代码运行得很好.
我如何在c#中做同样的事情?
HttpContext oc = HttpContext.Current;
foreach (object c in oc.Cache)
{
oc.Response.Write(c.key.ToString());
}
Run Code Online (Sandbox Code Playgroud)
它不喜欢.key.位.我在这里不知所措.有任何想法如何以这种方式访问密钥?