繁体   English   中英

你能删除存储在HttpContext.Current.Application [“variable”]中的值吗?

[英]Can you delete values stored in HttpContext.Current.Application[“variable”]?

你能删除存储在HttpContext.Current.Application["variable"]吗? 或者唯一的方法是将其设置为空字符串?

您可以使用Application.RemoveApplication.RemoveAllApplication.RemoveAt方法。

采用

HttpContext.Current.Application.Remove("variable");

此外,设置为null很好,因为如果你尝试读取HttpContext.Current.Application["variable"]并且那里没有值,它仍然会返回null ,但当然如果你想要的东西被删除,最好更明确。

HttpContext.Current.Application.Remove(...)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM