Class ActionDispatcher<T, TResult>
Namespace: Tool.Utils.ActionDelegate
Assembly: Tool.Net.dll
根据 MethodInfo 对象,创建一个委托,实现方法调用,提高性能,支持各种返回值(TResult)
public class ActionDispatcher<T, TResult> : IActionDispatcher<T>, IActionDispatcherType Parameters
T
调用类
TResult
返回值
Inheritance
object ← ActionDispatcher<T, TResult>
Implements
IActionDispatcher<T>, IActionDispatcher
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtension.Add<T>(object, object, object), DispatcherCore.AsAction<T, TResult>(IActionDispatcher), DispatcherCore.AsAction<T, TResult>(IActionDispatcher<T>), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Remarks
代码由逆血提供支持
Constructors
ActionDispatcher(MethodInfo)
初始化对象
public ActionDispatcher(MethodInfo methodInfo)Parameters
methodInfo MethodInfo
方法对象
ActionDispatcher(MethodInfo, Type)
初始化对象
public ActionDispatcher(MethodInfo methodInfo, Type classtype)Parameters
methodInfo MethodInfo
方法对象
classtype Type
调用类类型(明确调用类)
Properties
IsStatic
是否是静态方法
public bool IsStatic { get; }Property Value
IsTask
是否是 异步函数?
public bool IsTask { get; }Property Value
IsVoid
是否无返回值
public bool IsVoid { get; }Property Value
Method
当前方法的执行信息
public MethodInfo Method { get; }Property Value
MethodEnum
方法的公开类型
public MethodFlags MethodEnum { get; }Property Value
Name
方法名称
public string Name { get; }Property Value
Parameters
方法参数
public Parameter[] Parameters { get; }Property Value
ReturnType
调用接口的返回值
public Type ReturnType { get; }Property Value
Methods
Execute(T, params object[])
调用方法有返回值(注明:如调用的是静态方法,类参数可为 null)
public TResult Execute(T CallClass, params object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数
Returns
TResult
返回方法的返回值
ExecuteAsync(T, object[])
调用方法有返回值(注明:如调用的是静态方法,类参数可为 null)
public Task<TResult> ExecuteAsync(T CallClass, object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数
Returns
Task<TResult>
返回方法的返回值
Invoke(T, params object[])
可不区分是否有返回值的调用方法
public TResult Invoke(T CallClass, params object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数
Returns
TResult
返回方法的返回值
InvokeAsync(T, params object[])
可不区分是否有返回值的调用方法
public Task<TResult> InvokeAsync(T CallClass, params object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数
Returns
Task<TResult>
返回方法的返回值
ToString()
返回方法信息缩写
public override string ToString()Returns
VoidExecute(T, params object[])
调用方法无返回值(注明:如调用的是静态方法,类参数可为 null)
public void VoidExecute(T CallClass, params object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数
VoidExecuteAsync(T, object[])
调用方法无返回值(注明:如调用的是静态方法,类参数可为 null)
public Task VoidExecuteAsync(T CallClass, object[] parameters)Parameters
CallClass T
调用方法的类
parameters object[]
参数