mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
21 lines
595 B
C#
21 lines
595 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace GlitchyEngine.Extensions;
|
|
|
|
public static class MethodInfoExtension
|
|
{
|
|
/// <summary>
|
|
/// Gets the <see cref="Delegate"/> of this <see cref="MethodInfo"/>.
|
|
/// </summary>
|
|
/// <typeparam name="T">The type of the Delegate.</typeparam>
|
|
/// <param name="info">The method info.</param>
|
|
/// <returns>The delegate.</returns>
|
|
public static T GetDelegate<T>(this MethodInfo info) where T : Delegate
|
|
{
|
|
return (T)Delegate.CreateDelegate(typeof(T), info);
|
|
}
|
|
}
|