mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
ScriptEngine: Serialize static fields
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user