小编Qui*_*011的帖子

通过httpcache循环c#

在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.位.我在这里不知所措.有任何想法如何以这种方式访问​​密钥?

c# asp.net vb.net-to-c#

6
推荐指数
2
解决办法
6605
查看次数

标签 统计

asp.net ×1

c# ×1

vb.net-to-c# ×1