private void UseDefaultColor() { DefaultColorAttribute defaultColorAttribute = (DefaultColorAttribute)Attribute.GetCustomAttribute(typeof(Contact), typeof(DefaultColorAttribute)); if (defaultColorAttribute != null) { ForegroundColor = defaultColorAttribute.Color; } }
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; } }