private void UseDefaultColor()
        {
            DefaultColorAttribute defaultColorAttribute = (DefaultColorAttribute)Attribute.GetCustomAttribute(typeof(Contact), typeof(DefaultColorAttribute));

            if (defaultColorAttribute != null)
            {
                ForegroundColor = defaultColorAttribute.Color;
            }
        }
Esempio n. 2
0
        private void UseDefaultColor()
        {
            DefaultColorAttribute defaultColorAttribute =
                (DefaultColorAttribute)Attribute.GetCustomAttribute(typeof(Contact), typeof(DefaultColorAttribute));

            //If the DefaultColorAttribute was found int the Contact class.
            if (defaultColorAttribute != null)
            {
                Console.ForegroundColor = defaultColorAttribute.Color;
            }
        }