static public int LogOutputMask(string SwitchString) { int RetVal = 0; if (!String.IsNullOrEmpty(SwitchString)) { string[] OutputSwitch = SwitchString.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string ThisValue in OutputSwitch) { string CapturedSwitch = ThisValue.Trim().ToLower(); Int32 DirectValue = 0; if (Int32.TryParse(CapturedSwitch, out DirectValue)) { RetVal |= DirectValue; } else { string[] EnumNames = Enum.GetNames(typeof(OutputType)); for (int i = 0; i < EnumNames.Length; i++) { if (String.Equals(CapturedSwitch, EnumNames[i], StringComparison.OrdinalIgnoreCase)) { OutputType[] TheValues = (OutputType[])Enum.GetValues(typeof(OutputType)); RetVal |= (int)TheValues[i]; break; } } } } } return(RetVal); }