The documentation states that it "Represents a case-insensitive collection of key/value pairs that you use in various places in the routing framework, such as when you define the default values for a route or when you generate a URL that is based on a route."
From what I can see, it uses a normal Dictionary<string,object>
to store it's keys internally, so it's actually case-sensitive. I cannot find any aspect of this class that's case-insensitive, so is the documentation just wrong?
Your statement that using
Dictionary<string, object>
makes the comparison case-sensitive is incorrect.Dictionary<TKey, TValue>
allows for a customIEqualityComparer<TKey>
implementation to be provided into the constructor.RouteValueDictionary
does exactly that and passesStringComparer.OrdinalIgnoreCase
toDictionary<string, object>
constructor:So to answer the question:
RouteValueDictionary
is case-insensitive.See the code on sourceof.net: https://referencesource.microsoft.com/#System.Web/Routing/RouteValueDictionary.cs,551a423c96bb6648