Class WaitAction<T, TResult>
Namespace: Tool.Utils.ThreadQueue
Assembly: Tool.Net.dll
创建任务执行对象
public class WaitAction<T, TResult> : IDisposableType Parameters
T
TResult
Inheritance
object ← WaitAction<T, TResult>
Implements
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), 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
WaitAction(Func<T, ValueTask<TResult>>, T)
创建有返回结果的任务
public WaitAction(Func<T, ValueTask<TResult>> func, T state)Parameters
func Func<T, ValueTask<TResult>>
任务
state T
参数
WaitAction(Action<T>, T)
创建无返回结果的任务
public WaitAction(Action<T> action, T state)Parameters
action Action<T>
任务
state T
参数
Properties
Exception
任务执行中发生的异常
public Exception Exception { get; }Property Value
IsCompleted
任务完成情况
public bool IsCompleted { get; }Property Value
IsException
是否发生异常
public bool IsException { get; }Property Value
IsWait
是否正在调用Wait函数
public bool IsWait { get; }Property Value
Result
任务完成后的结果
public TResult Result { get; }Property Value
TResult
State
需要的参数
public T State { get; }Property Value
T
WaitTimeout
Wait函数最大等待时长 -1 无限制等待
public int WaitTimeout { get; set; }Property Value
Methods
Dispose()
回收对象
public void Dispose()Run()
启动已就绪的任务
public ValueTask Run()Returns
Wait()
其他线程中可用等待获取的任务结果
public bool Wait()Returns
返回成功失败