Skip to content

Instantly share code, notes, and snippets.

@jindeveloper
Created August 21, 2020 07:31
Show Gist options
  • Select an option

  • Save jindeveloper/4f65756f5bb9d73e95858e6eac96d79a to your computer and use it in GitHub Desktop.

Select an option

Save jindeveloper/4f65756f5bb9d73e95858e6eac96d79a to your computer and use it in GitHub Desktop.
using CSharp_Attributes_Walkthrough.My_Custom_Attributes;
using System;
namespace Implementing_Csharp_Attributes_101
{
class Program
{
static void Main(string[] args)
{
var customer = new Customer { Firstname = "Jin Vincent" , LastName = "Necesario" };
var aliasAttributeType = customer.GetType();
var attribute = aliasAttributeType.GetCustomAttributes(typeof(AliasAttribute), false);
Console.ForegroundColor = ((AliasAttribute)attribute[0]).Color;
Console.WriteLine(customer.ToString());
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment