Exemplo n.º 1
0
        public bool NonGenericEnums_IsDefined_False()
        {
            var result = false;

            foreach (var value in _undefinedValues)
            {
                result |= NonGenericEnums.IsDefined(_enumType, value);
            }
            return(result);
        }
Exemplo n.º 2
0
        public static void IsDefined(DayOfWeek[] dayOfWeekArray)
        {
            const int iterations = 250000;

            var dayOfWeekType = typeof(DayOfWeek);

            using (new OperationTimer("Enum.IsDefined Performance"))
            {
                for (var i = 0; i < iterations; ++i)
                {
                    for (var j = 0; j < dayOfWeekArray.Length; ++j)
                    {
                        Enum.IsDefined(dayOfWeekType, dayOfWeekArray[j]);
                    }
                }
            }

            using (new OperationTimer("NonGenericEnums.IsDefined Performance"))
            {
                for (var i = 0; i < iterations; ++i)
                {
                    for (var j = 0; j < dayOfWeekArray.Length; ++j)
                    {
                        NonGenericEnums.IsDefined(dayOfWeekType, dayOfWeekArray[j]);
                    }
                }
            }

            using (new OperationTimer("Enums.IsDefined Performance"))
            {
                for (var i = 0; i < iterations; ++i)
                {
                    for (var j = 0; j < dayOfWeekArray.Length; ++j)
                    {
                        dayOfWeekArray[j].IsDefined();
                    }
                }
            }

            using (new OperationTimer("Enums.IsValid Performance"))
            {
                for (var i = 0; i < iterations; ++i)
                {
                    for (var j = 0; j < dayOfWeekArray.Length; ++j)
                    {
                        dayOfWeekArray[j].IsValid();
                    }
                }
            }
        }