Files
Toolkit2/Toolkit.Foundation/TypeExtensions.cs
T
TheXamlGuy bc55c4649b tidy
2024-04-26 23:05:36 +01:00

17 lines
365 B
C#

using System.Reflection;
namespace Toolkit.Foundation;
public static class TypeExtensions
{
public static TAttribute? GetAttribute<TAttribute>(this Type type)
where TAttribute : Attribute
{
if (type.GetCustomAttribute<TAttribute>() is TAttribute attribute)
{
return attribute;
}
return null;
}
}