Skip to content

Instantly share code, notes, and snippets.

@AdamDotNet
AdamDotNet / ParallelAsync.cs
Last active February 22, 2020 17:07
Attempts to replicate Parallel.For, but allows the action to be async, Task returning without the async-void problem of doing so with Parallel.For.
using System;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace Async.ChannelUtilities
{
/// <summary>
/// Like <see cref="Parallel.For"/> but allows the method body to be an <see langword="async"/>, <see cref="Task"/> returning <see cref="Delegate"/>
/// without running into the async-void problem.
@AdamDotNet
AdamDotNet / ReturnsExtensions.cs
Created August 31, 2017 16:37
Moq ValueTask ReturnsExtensions
using Moq.Language;
using Moq.Language.Flow;
using System;
using System.Threading.Tasks;
/* See the System.Threading.Tasks.Extensions NuGet */
namespace Moq
{
/// <summary>
/// Defines async extension methods on IReturns.