DumpAsync
It would be great if the following extension methods could be built-in to LINQPad. Currently I have them in my personal extensions, but it prevents me from sharing LINQPad scripts with colleagues without adding them directly into the scripts before sending them.
Thanks for the amazing product!!
public static async Task<T> DumpAsync<T>(this Task<T> task) => (await task).Dump();
public static async Task<T> DumpAsync<T>(this Task<T> task, string description) => (await task).Dump(description);
public static async Task<T> DumpAsync<T>(this Task<T> task, int depth) => (await task).Dump(depth);
public static async Task<T> DumpAsync<T>(this Task<T> task, string description, int depth) => (await task).Dump(description, depth);
public static async Task<T> DumpAsync<T>(this ValueTask<T> task) => (await task).Dump();
public static async Task<T> DumpAsync<T>(this ValueTask<T> task, string description) => (await task).Dump(description);
public static async Task<T> DumpAsync<T>(this ValueTask<T> task, int depth) => (await task).Dump(depth);
Usage:
// Without DumpAsync
var foo = (await DoWorkAsync()).Dump();
// With DumpAsync
var foo = await DoWorkAsync().DumpAsync();
1
vote
Christopher Haws
shared this idea