using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using static Serein.Library.Utils.EmitHelper;
namespace Serein.Library
{
///
/// Emit创建的委托描述,用于WebApi、WebSocket、NodeFlow动态调用方法的场景。
/// 一般情况下你无须内部细节,只需要调用 Invoke() 方法即可。
///
public class DelegateDetails
{
///
/// 根据方法信息构建Emit委托
///
///
public DelegateDetails(MethodInfo methodInfo)
{
var emitMethodType = EmitHelper.CreateDynamicMethod(methodInfo, out var emitDelegate);
_emitMethodInfo = emitMethodType;
_emitDelegate = emitDelegate;
SetFunc();
}
private void SetFunc()
{
if (_emitDelegate is Func