Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Web / Util / SecUtil.cs
index 9a104eabbf598ee8deff7ab499926c6935696e05..db01aa6563352aa3d12ea2538022e85b3691b8d2 100644 (file)
@@ -158,7 +158,7 @@ namespace System.Web.Util {
 
             Hashtable values = new Hashtable(param.Length);
             for (int i = param.Length - 1; i >= 0; i--) {
-                SecUtility.CheckParameter(ref param[i], checkForNull, checkIfEmpty, checkForCommas, maxSize, 
+                SecUtility.CheckParameter(ref param[i], checkForNull, checkIfEmpty, checkForCommas, maxSize,
                     paramName + "[ " + i.ToString(CultureInfo.InvariantCulture) + " ]");
                 if (values.Contains(param[i])) {
                     throw new ArgumentException(SR.GetString(SR.Parameter_duplicate_array_element, paramName), paramName);
@@ -215,6 +215,17 @@ namespace System.Web.Util {
             return iValue;
         }
 
+        internal static TimeUnit GetTimeoutUnit(NameValueCollection config, string valueName, TimeUnit defaultValue) {
+            TimeUnit unit;
+            string sValue = config[valueName];
+
+            if (sValue == null || !Enum.TryParse(sValue, out unit)) {
+                return defaultValue;
+            }
+
+            return unit;
+        }
+
         internal static int? GetNullableIntValue(NameValueCollection config, string valueName) {
             int iValue;
             string sValue = config[valueName];