private static CompletedAsyncInfo <T, TProgress> CreateCache <T>(T result) { if (Equals(result, default(T))) { return(CompletedAsyncInfo <T, TProgress> .Instanse); } return(CompletedAsyncInfo <T, TProgress> .Create(result)); }
/// <summary> /// Create a complated <see cref="IAsyncOperationWithProgress{TResult, TProgress}"/>. /// </summary> /// <param name="results">Results of the operation.</param> /// <returns>A complated <see cref="IAsyncOperationWithProgress{TResult, TProgress}"/>.</returns> public static IAsyncOperationWithProgress <T, TProgress> CreateCompleted(T results) => AsyncOperationCache <TProgress> .TryGetCacehd(results) ?? CompletedAsyncInfo <T, TProgress> .Create(results);
/// <summary> /// Create a complated <see cref="IAsyncOperation{TResult}"/>. /// </summary> /// <param name="results">Results of the operation.</param> /// <returns>A complated <see cref="IAsyncOperation{TResult}"/>.</returns> public static IAsyncOperation <T> CreateCompleted(T results) => AsyncOperationCache <VoidProgress> .TryGetCacehd(results) ?? CompletedAsyncInfo <T, VoidProgress> .Create(results);