[英]Can you delete values stored in HttpContext.Current.Application[“variable”]?
你能刪除存儲在HttpContext.Current.Application["variable"]
嗎? 或者唯一的方法是將其設置為空字符串?
您可以使用Application.Remove
, Application.RemoveAll
和Application.RemoveAt
方法。
采用
HttpContext.Current.Application.Remove("variable");
此外,設置為null
很好,因為如果你嘗試讀取HttpContext.Current.Application["variable"]
並且那里沒有值,它仍然會返回null
,但當然如果你想要的東西被刪除,最好更明確。
HttpContext.Current.Application.Remove(...)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.