Table of Contents

Method TryConvertToValueTask

Namespace
Xunit.Sdk
Assembly
xunit.v3.common.dll

TryConvertToValueTask(object?)

Given an object, will attempt to convert instances of Task or Microsoft.FSharp.Control.FSharpAsync`1 into ValueTask as appropriate. Will return null if the object is not a task of any supported type. Note that this list of supported tasks is purposefully identical to the list used by IsAsync(MethodInfo).

public static ValueTask? TryConvertToValueTask(object? obj)

Parameters

obj object

The object to convert

Returns

ValueTask?

Returns a ValueTask for the given object, if it's compatible; returns null otherwise.