/// <summary> /// Initializes the check list from an enumerated type and sets its initial checks. /// </summary> /// <typeparam name="T">Enumerated type used to set the items.</typeparam> /// <param name="val">The flag value used to check the items.</param> /// <param name="mgr">The <see cref="System.Resources.ResourceManager"/> that holds the display text for each enumerated value.</param> /// <param name="prefix">(Optional) The prefix used in front of the enumeration value to pull from the resource file. If <c>null</c>, then this value defaults to the name of the enumerated type specified by <typeparamref name="T"/>.</param> /// <param name="exclude">(Optional) The excluded items from the enumerated type.</param> public void InitializeAndSet <T>(T val, System.Resources.ResourceManager mgr, string prefix = null, T[] exclude = null) where T : struct, IConvertible { EnumUtil.CheckIsEnum <T>(true); string[] excl = exclude == null ? null : Array.ConvertAll <T, string>(exclude, t => t.ToString()); InitializeFromEnum(typeof(T), mgr, prefix, excl); CheckedFlagValue = Convert.ToInt64(val); }