【发布时间】:2012-01-02 20:59:48
【问题描述】:
在 VB.NET 上,我可以这样做来写出缓存中的所有键:
Dim oc As HttpContext = HttpContext.Current
For Each c As Object In oc.Cache
oc.Response.Write(c.Key.ToString())
Next
虽然 .Key 没有出现在 Intellisense 中,但代码工作正常。
我如何在 c# 中做同样的事情?
HttpContext oc = HttpContext.Current;
foreach (object c in oc.Cache)
{
oc.Response.Write(c.key.ToString());
}
它不喜欢 .key。少量。我在这里不知所措。任何想法如何以这种方式访问密钥?
【问题讨论】:
标签: c# asp.net vb.net-to-c#