using System;
using System.Linq;
using System.Reflection;
using System.Linq.Expressions;
namespace GraphicsCat
{
public static class ReflectionUtils
{
#region Method Invocation (supports private methods)
///
/// Invoke instance method (supports private methods)
///
public static object InvokeMethod(T instance, string methodName, object[] parameters = null)
{
if (instance == null)
throw new ArgumentNullException(nameof(instance));
var methodInfo = GetMethodInfo(methodName, parameters);
return methodInfo.Invoke(instance, parameters ?? Array.Empty