コード例 #1
0
        /// <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());
        }
コード例 #2
0
        public ConstantEnumerationValueFilter(Enum[] disabledValues)
        {
            ArgumentUtility.CheckNotNullOrEmptyOrItemsNull("disabledValues", disabledValues);
            ArgumentUtility.CheckItemsType("disabledValues", disabledValues, disabledValues[0].GetType());

            _disabledEnumValues = disabledValues;
        }
コード例 #3
0
        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;
        }