TryGetValueAsync<T> Method
Tries to get a value for a given format from a IAsyncDataTransfer.
Definition
Namespace: Avalonia.Input
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public static Task<T> TryGetValueAsync<T>(
this IAsyncDataTransfer dataTransfer,
DataFormat<T> format
)
where T : class
<ExtensionAttribute>
Public Shared Function TryGetValueAsync(Of T As Class) (
dataTransfer As IAsyncDataTransfer,
format As DataFormat(Of T)
) As Task(Of T)
[<ExtensionAttribute>]
static member TryGetValueAsync :
dataTransfer : IAsyncDataTransfer *
format : DataFormat<'T> -> Task<'T> when 'T : not struct
Parameters
- IAsyncDataTransfer
- The IAsyncDataTransfer instance.
- DataFormat(T)
- The format to retrieve.
Type Parameters
Return Value
Task(T)
A value for format, or null if the format is not supported.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IAsyncDataTransfer. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
If the IAsyncDataTransfer contains several items supporting format, the first matching one will be returned.