private static int InitializeDefaultCollectionKeySize()
{
// we first detect if we are running on 4.5, return Max value if we are.
Type comparerType = Type.GetType(IWellKnownComparerTypeName, throwOnError: false);
if (comparerType != null)
{
return Int32.MaxValue;
}
// we should try to read it from the AppSettings
// if we found the aspnet settings configured, we will use that. Otherwise, we used the default
NameValueCollection settings = ConfigurationManager.AppSettings;
int result;
if (settings == null || !Int32.TryParse(settings["aspnet:MaxHttpCollectionKeys"], out result) || result < 0)
{
result = DefaultMaxHttpCollectionKeys;
}
return result;
}