/// <summary> /// Initializes a new instance of the <see cref="DisableEnumValuesAttribute"/> class with a number of enum values to disable. /// </summary> /// <param name="disabledEnumValues">The disabled enum values.</param> public DisableEnumValuesAttribute(params object[] disabledEnumValues) { ArgumentUtility.CheckNotNull("disabledEnumValues", disabledEnumValues); ArgumentUtility.CheckItemsType("disabledEnumValues", disabledEnumValues, typeof(Enum)); _filter = new ConstantEnumerationValueFilter(disabledEnumValues.Cast <Enum>().ToArray()); }
public ConstantEnumerationValueFilter(Enum[] disabledValues) { ArgumentUtility.CheckNotNullOrEmptyOrItemsNull("disabledValues", disabledValues); ArgumentUtility.CheckItemsType("disabledValues", disabledValues, disabledValues[0].GetType()); _disabledEnumValues = disabledValues; }
private DemandPermissionAttribute(object[] accessTypes) { ArgumentUtility.CheckNotNullOrEmptyOrItemsNull("accessTypes", accessTypes); ArgumentUtility.CheckItemsType("accessTypes", accessTypes, typeof(Enum)); Enum[] accessTypeEnums = new Enum[accessTypes.Length]; for (int i = 0; i < accessTypes.Length; i++) { accessTypeEnums[i] = GetAccessType(accessTypes[i]); } _accessTypes = accessTypeEnums; }