Rediger

Del via


IsolatedStorageFile.CopyFile Method

Definition

Copies an existing file to a new file.

Overloads

CopyFile(String, String)

Copies an existing file to a new file.

CopyFile(String, String, Boolean)

Copies an existing file to a new file, and optionally overwrites an existing file.

CopyFile(String, String)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

Copies an existing file to a new file.

public:
 void CopyFile(System::String ^ sourceFileName, System::String ^ destinationFileName);
public void CopyFile (string sourceFileName, string destinationFileName);
[System.Runtime.InteropServices.ComVisible(false)]
public void CopyFile (string sourceFileName, string destinationFileName);
member this.CopyFile : string * string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.CopyFile : string * string -> unit
Public Sub CopyFile (sourceFileName As String, destinationFileName As String)

Parameters

sourceFileName
String

The name of the file to copy.

destinationFileName
String

The name of the destination file. This cannot be a directory or an existing file.

Attributes

Exceptions

sourceFileName or destinationFileName is a zero-length string, contains only white space, or contains one or more invalid characters defined by the GetInvalidPathChars() method.

sourceFileName or destinationFileName is null.

The isolated store has been closed.

The isolated store has been disposed.

sourceFileName was not found.

sourceFileName was not found.

The isolated store has been removed.

-or-

Isolated storage is disabled.

-or-

destinationFileName exists.

-or-

An I/O error has occurred.

Remarks

sourceFileName and destinationFileName must specify different file names. Use the IsolatedStorageFile.CopyFile(String, String, Boolean) method overload to overwrite an existing file.

See also

Applies to

CopyFile(String, String, Boolean)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

Copies an existing file to a new file, and optionally overwrites an existing file.

public:
 void CopyFile(System::String ^ sourceFileName, System::String ^ destinationFileName, bool overwrite);
public void CopyFile (string sourceFileName, string destinationFileName, bool overwrite);
[System.Runtime.InteropServices.ComVisible(false)]
public void CopyFile (string sourceFileName, string destinationFileName, bool overwrite);
member this.CopyFile : string * string * bool -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.CopyFile : string * string * bool -> unit
Public Sub CopyFile (sourceFileName As String, destinationFileName As String, overwrite As Boolean)

Parameters

sourceFileName
String

The name of the file to copy.

destinationFileName
String

The name of the destination file. This cannot be a directory.

overwrite
Boolean

true if the destination file can be overwritten; otherwise, false.

Attributes

Exceptions

sourceFileName or destinationFileName is a zero-length string, contains only white space, or contains one or more invalid characters defined by the GetInvalidPathChars() method.

sourceFileName or destinationFileName is null.

The isolated store has been closed.

The isolated store has been disposed.

sourceFileName was not found.

sourceFileName was not found.

The isolated store has been removed.

-or-

Isolated storage is disabled.

-or-

An I/O error has occurred.

Remarks

sourceFileName and destinationFileName can have the same file name if overwrite is true.

See also

Applies to