FileCopyCopyTo Method

Asynchronously copies the source file to the specified destination.

Definition

Namespace: DevCase.Core.IO.FileSystem
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public virtual CancellationTokenSource CopyTo(
	string targetFilepath,
	int bufferSize = 1024,
	bool overwrite = false,
	bool deleteFileOnCancel = false,
	Action cancelCallback = null
)

Parameters

targetFilepath  String
The target filepath.
bufferSize  Int32  (Optional)
The size, in bytes, of the internal FileStream buffer that is used to copy.
overwrite  Boolean  (Optional)
If set to , overwrites any existing file, otherwise, a IOException exception is thrown.
deleteFileOnCancel  Boolean  (Optional)
If set to , deletes the target file if the copy operation was cancelled
cancelCallback  Action  (Optional)
A encapsulated method that is called if the copy operation is cancelled.

Return Value

CancellationTokenSource
A CancellationTokenSource instance to cancel the file-copy task at any moment.

This value can be pass to the CancelCopy(CancellationTokenSource).

Exceptions

FileNotFoundException File not found.;targetFilepath
IOException Target file already exists.
ArgumentException Positive value is required.;bufferSize

See Also