Created
August 21, 2020 07:31
-
-
Save jindeveloper/4f65756f5bb9d73e95858e6eac96d79a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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