mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-13 20:47:24 +00:00
GetCustomAttributes method can cast attributes
This commit is contained in:
parent
3b0bab02de
commit
70c5f817c5
1 changed files with 2 additions and 2 deletions
|
|
@ -245,14 +245,14 @@ namespace ICD.Common.Utils
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="assembly"></param>
|
/// <param name="assembly"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<object> GetCustomAttributes<T>(Assembly assembly)
|
public static IEnumerable<T> GetCustomAttributes<T>(Assembly assembly)
|
||||||
where T : Attribute
|
where T : Attribute
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
if (assembly == null)
|
||||||
throw new ArgumentNullException("assembly");
|
throw new ArgumentNullException("assembly");
|
||||||
|
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
return assembly.GetCustomAttributes(typeof(T), false);
|
return assembly.GetCustomAttributes(typeof(T), false).Cast<T>();
|
||||||
#else
|
#else
|
||||||
return assembly.GetCustomAttributes<T>();
|
return assembly.GetCustomAttributes<T>();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue