mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
20 lines
561 B
C#
20 lines
561 B
C#
using System;
|
|
using System.Reflection;
|
|
|
|
namespace GlitchyEngine.Extensions;
|
|
|
|
/// <summary>
|
|
/// Extends <see cref="MemberInfo"/> with useful methods.
|
|
/// </summary>
|
|
public static class MemberInfoExtension
|
|
{
|
|
/// <summary>
|
|
/// Returns <see langword="true"/> if the member has the specified attribute.
|
|
/// </summary>
|
|
/// <typeparam name="T">The type of the attribute.</typeparam>
|
|
public static bool HasCustomAttribute<T>(this MemberInfo memberInfo) where T : Attribute
|
|
{
|
|
return memberInfo.GetCustomAttribute<T>() != null;
|
|
}
|
|
}
|