Skip to main content

TryGetValue<T> Method

Tries to get a value for a given format from a IDataTransfer.

Definition​

Namespace: Avalonia.Input
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static T TryGetValue<T>(
this IDataTransfer dataTransfer,
DataFormat<T> format
)
where T : class

Parameters​

  IDataTransfer
The IDataTransfer instance.
  DataFormat(T)
The format to retrieve.

Type Parameters​

Return Value​

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 IDataTransfer. 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 IDataTransfer contains several items supporting format, the first matching one will be returned.

See Also​

Reference​

DataTransferExtensions Class
Avalonia.Input Namespace