Session.Clear() vs. 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?


Solution 1:

They are absolutely the same. RemoveAll calls Clear internally. From Reflector:

public sealed class HttpSessionState : ICollection, IEnumerable
{
    ...

    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public void RemoveAll()
    {
        this.Clear();
    }

    ...
}