System.Web.Security.SqlMembershipProvider.GetEnumConfigValue C# (CSharp) Method

GetEnumConfigValue() private method

private GetEnumConfigValue ( NameValueCollection config, string name, Type enumType, int def ) : int
config System.Collections.Specialized.NameValueCollection
name string
enumType Type
def int
return int
		int GetEnumConfigValue (NameValueCollection config, string name, Type enumType, int def)
		{
			int rv = def;
			string val = config [name];
			if (val != null) {
				try { rv = (int) Enum.Parse (enumType, val); }
				catch (Exception e) {
					throw new ProviderException (String.Format ("{0} must be one of the following values: {1}", name, String.Join (",", Enum.GetNames (enumType))), e);
				}
			}
			return rv;
		}