Session.Clear()
和 Session.RemoveAll()
有区别吗?
描述和文档页面似乎说的完全一样,但是 我假设创建两个函数一定有某种原因,对吗?
最佳答案
它们完全相同。 RemoveAll
在内部调用 Clear
。来自反射器:
public sealed class HttpSessionState : ICollection, IEnumerable
{
...
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public void RemoveAll()
{
this.Clear();
}
...
}
关于c# - Session.Clear() 与 Session.RemoveAll(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3931331/