public static IEnumerable <string> YieldSha256Hash(int count) { var i = 0; while (i < count) { i++; yield return(Sha256Service.ComputeSha256Hash(i.ToString())); } }
public static async IAsyncEnumerable <string> YieldSha256HashAsync(int count) { var i = 0; while (i < count) { i++; await Task.Delay(1000); //something takes a while yield return(Sha256Service.ComputeSha256Hash(i.ToString())); } }