Created
December 11, 2013 13:09
-
-
Save feanz/7910136 to your computer and use it in GitHub Desktop.
MethodInfoExtensions
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
public static class MethodInfoExtensions | |
{ | |
/// <summary> | |
/// Will return the name of the action specified in the ActionNameAttribute for a method if it has an ActionNameAttribute. | |
/// Will return the name of the method otherwise. | |
/// </summary> | |
/// <param name="method"></param> | |
/// <returns></returns> | |
public static string ActionName(this MethodInfo method) | |
{ | |
if (method.IsDecoratedWith<ActionNameAttribute>()) return method.GetAttribute<ActionNameAttribute>().Name; | |
return method.Name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment