Last active
August 29, 2015 14:05
-
-
Save lmatt-bit/2ce8e1419ebcbd5d6ab9 to your computer and use it in GitHub Desktop.
Generic method & Extension method
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
| namespace ExtensionExample { | |
| public static class ExtensionExampleClass { | |
| public static T[] GetCustomAttributes<T>(this Type type, bool inherit) where T : Attribute { | |
| var attributes = type.GetCustomAttributes(typeof(T), inherit); | |
| return attributes as T[]; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment