Session.Clear() 与 Session.RemoveAll()
Session.Clear()
和 Session.RemoveAll()
之间有区别吗?
描述和文档页面似乎说的是完全相同的事情,但是 我假设创建两个函数一定有某种原因,对吗?
Is there a difference between Session.Clear()
and Session.RemoveAll()
?
The descriptions and documentation pages seem to say exactly the same thing, but
I am assuming there must be some reason for creating two functions, am I right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它们完全一样。
RemoveAll
在内部调用Clear
。来自反射镜:They are absolutely the same.
RemoveAll
callsClear
internally. From Reflector:为了节省你总是可以像这样调用它们......
VB.NET 示例,我确信你需要做的就是放置 ;在他们每个人的最后。
这对我来说很有效,因为我的会话在没有被删除之前遇到了一些问题。
To be save you can always just call them all like so....
VB.NET example, I am sure all you need to do is place the ; at the end of each of them.
This did the trick for me as I had some problems with my Session before where they were not removed.