Share via


TransferTargetWatcher.IsSupported(DataPackageView) Method

Definition

The IsSupported method determines whether the specified data package is supported by any transfer targets. This method helps applications verify compatibility before initiating a sharing operation.

public:
 static bool IsSupported(DataPackageView ^ dataPackage);
/// [Windows.Foundation.Metadata.Experimental]
 static bool IsSupported(DataPackageView const& dataPackage);
[Windows.Foundation.Metadata.Experimental]
public static bool IsSupported(DataPackageView dataPackage);
function isSupported(dataPackage)
Public Shared Function IsSupported (dataPackage As DataPackageView) As Boolean

Parameters

dataPackage
DataPackageView

A DataPackageView object that represents the data package to check for compatibility. This parameter specifies the content to be shared.

Returns

Boolean

bool

A bool value that is true if the data package is supported by at least one transfer target; otherwise, false.

Attributes

Examples

Example: Checking if a Data Package is Supported

var isSupported = TransferTargetWatcher.IsSupported(dataPackage);
if (isSupported)
{
    Console.WriteLine("The data package is supported.");
}
else
{
    Console.WriteLine("The data package is not supported.");
}

Remarks

The IsSupported method is a static method that allows applications to check whether the specified data package can be handled by any available transfer targets. This is useful for ensuring that sharing operations are only attempted with compatible data.

Usage Notes:

  • Use this method to validate the data package before calling methods like TransferToAsync.
  • If the method returns false, consider providing feedback to the user about the unsupported data.

Applies to

See also