补充了Library的注释

This commit is contained in:
fengjiayi
2024-10-11 19:31:34 +08:00
parent aa85c907a3
commit 5bef0d9b57
27 changed files with 202 additions and 239 deletions

View File

@@ -8,12 +8,24 @@ using System.Threading.Tasks;
namespace Serein.Library.Utils
{
/// <summary>
/// Emit创建委托工具类
/// </summary>
public class EmitHelper
{
public enum EmitMethodType
{
/// <summary>
/// 普通的方法。如果方法返回void时将会返回null。
/// </summary>
Func,
/// <summary>
/// 无返回值的异步方法
/// </summary>
Task,
/// <summary>
/// 有返回值的异步方法
/// </summary>
HasResultTask,
}
public static bool IsGenericTask(Type returnType, out Type taskResult)
@@ -38,11 +50,6 @@ namespace Serein.Library.Utils
}
}
//public static Delegate CreateDynamicMethod<T>(MethodInfo methodInfo)
//{
// return CreateDynamicMethod(methodInfo);
//}
public static EmitMethodType CreateDynamicMethod( MethodInfo methodInfo,out Delegate @delegate)
{
bool IsTask = IsGenericTask(methodInfo.ReturnType, out var taskGenericsType);