Пример #1
0
        private static DisplayAttribute GetDisplayAttribute(Enum enumValue)
        {
            DisplayAttribute displayAttribute =
                enumValue.GetType()
                .GetMember(enumValue.ToString())
                .Single()
                .GetCustomAttributes(false)
                .OfType <DisplayAttribute>()
                .SingleOrDefault();

            if (displayAttribute.IsNull())
            {
                throw new NotFoundException();
            }

            return(displayAttribute);
        }