ScriptEngine: Serialize static fields

This commit is contained in:
Simon Lübeß
2024-04-13 00:10:35 +02:00
parent df13aa8596
commit 949ab4ebb0
16 changed files with 504 additions and 244 deletions
@@ -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;
}
}