Skip to content

Instantly share code, notes, and snippets.

@lmatt-bit
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save lmatt-bit/2ce8e1419ebcbd5d6ab9 to your computer and use it in GitHub Desktop.

Select an option

Save lmatt-bit/2ce8e1419ebcbd5d6ab9 to your computer and use it in GitHub Desktop.
Generic method & Extension method
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