Skip to content

Instantly share code, notes, and snippets.

@codereflection
Created July 26, 2013 22:14
Show Gist options
  • Save codereflection/6092622 to your computer and use it in GitHub Desktop.
Save codereflection/6092622 to your computer and use it in GitHub Desktop.
NullTask
/// <summary>
/// NullTask is a task that does nothing in Null Object Pattern fashion
/// </summary>
public class NullTask : Task
{
public NullTask() : base(() => { }) { }
}
@Buildstarted
Copy link

public static class TaskHelpers {
    public static Task Empty() {
        var tcs = new TaskCompletionSource<object>();
        tcs.SetResult(null);
        return tcs.Task;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment