Share via


TransferTargetInvokeResult Class

Definition

The TransferTargetInvokeResult class represents the result of an attempt to invoke a transfer target. It provides information about whether the invocation succeeded and any associated error details.

public ref class TransferTargetInvokeResult sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 1245184)]
/// [Windows.Foundation.Metadata.Experimental]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class TransferTargetInvokeResult final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 1245184)]
[Windows.Foundation.Metadata.Experimental]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class TransferTargetInvokeResult
Public NotInheritable Class TransferTargetInvokeResult
Inheritance
Object Platform::Object IInspectable TransferTargetInvokeResult
Attributes

Windows requirements

Requirements Description
Device family
Windows 11, version 24H2 (introduced in 10.0.26100.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v19.0)

Examples

Example: Handling the Result of a Transfer Target Invocation

var result = await watcher.TransferToAsync(target, dataPackage);
if (result.Succeeded)
{
    Console.WriteLine("Transfer succeeded.");
}
else
{
    Console.WriteLine($"Transfer failed with error: {result.ExtendedError}");
}

Remarks

This class is used to capture the outcome of invoking a transfer target with a data package. It helps developers handle success and error scenarios effectively.

Key Properties:

  • Succeeded: Indicates whether the invocation was successful.
  • ExtendedError: Provides additional error information if the invocation failed.

Usage:

The TransferTargetInvokeResult is returned by methods such as TransferTargetWatcher.TransferToAsync to indicate the result of the operation.

Properties

Name Description
ExtendedError

The ExtendedError property gets the exception that provides additional information about why the transfer operation failed. This property is useful for diagnosing issues during the invocation of a transfer target.

Succeeded

The Succeeded property indicates whether the transfer operation was successful. This property helps applications determine the outcome of invoking a transfer target.

Applies to

See also