IsolatedStorageFile.CopyFile 方法

定义

将现有文件复制到新文件。Copies an existing file to a new file.

重载

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)

将现有文件复制到新文件。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)

参数

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.

属性

例外

sourceFileNamedestinationFileName 是长度为零的字符串,仅包含空格,或包含 GetInvalidPathChars() 方法定义的一个或多个无效字符。sourceFileName or destinationFileName is a zero-length string, contains only white space, or contains one or more invalid characters defined by the GetInvalidPathChars() method.

sourceFileNamedestinationFileNamenullsourceFileName or destinationFileName is null.

已关闭独立存储区。The isolated store has been closed.

已释放独立存储区。The isolated store has been disposed.

未找到 sourceFileNamesourceFileName was not found.

未找到 sourceFileNamesourceFileName was not found.

已移除独立存储区。The isolated store has been removed.

- 或 --or- 已禁用独立存储。Isolated storage is disabled.

- 或 --or- destinationFileName 已存在。destinationFileName exists.

- 或 --or- 发生了 I/O 错误。An I/O error has occurred.

注解

sourceFileNamedestinationFileName 必须指定不同的文件名。sourceFileName and destinationFileName must specify different file names. 使用 IsolatedStorageFile.CopyFile(String, String, Boolean) 方法重载覆盖现有文件。Use the IsolatedStorageFile.CopyFile(String, String, Boolean) method overload to overwrite an existing file.

适用于

CopyFile(String, String, Boolean)

将现有文件复制到新文件,还可以覆盖现有文件。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)

参数

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;否则为 falsetrue if the destination file can be overwritten; otherwise, false.

属性

例外

sourceFileNamedestinationFileName 是长度为零的字符串,仅包含空格,或包含 GetInvalidPathChars() 方法定义的一个或多个无效字符。sourceFileName or destinationFileName is a zero-length string, contains only white space, or contains one or more invalid characters defined by the GetInvalidPathChars() method.

sourceFileNamedestinationFileNamenullsourceFileName or destinationFileName is null.

已关闭独立存储区。The isolated store has been closed.

已释放独立存储区。The isolated store has been disposed.

未找到 sourceFileNamesourceFileName was not found.

未找到 sourceFileNamesourceFileName was not found.

已移除独立存储区。The isolated store has been removed.

- 或 --or-

已禁用独立存储。Isolated storage is disabled.

- 或 --or-

发生了 I/O 错误。An I/O error has occurred.

注解

sourceFileName 如果为,则和 destinationFileName 可具有相同的文件名 overwrite truesourceFileName and destinationFileName can have the same file name if overwrite is true.

适用于