Created
October 6, 2016 14:43
-
-
Save WiredUK/9e511ba71df22e3190ca333dbdc788cb to your computer and use it in GitHub Desktop.
This file contains 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
[Blah(SomeValue = 4)] | |
public void DoStuff() | |
{ | |
var method = MethodBase.GetCurrentMethod(); | |
var attr = (BlahAttribute)method.GetCustomAttributes(typeof(BlahAttribute), true)[0]; | |
var value = attr.SomeValue; | |
Console.WriteLine(value); | |
} | |
private class BlahAttribute : Attribute | |
{ | |
public int SomeValue { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment