IsolatedStorageFile.CopyFile 方法

定义

将现有文件复制到新文件。

重载

CopyFile(String, String)

将现有文件复制到新文件。

CopyFile(String, String, Boolean)

将现有文件复制到新文件,还可以覆盖现有文件。

CopyFile(String, String)

将现有文件复制到新文件。

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

要复制的文件的名称。

destinationFileName
String

目标文件的名称。 它不能是一个目录或现有文件。

属性

例外

sourceFileNamedestinationFileName 是长度为零的字符串,仅包含空格,或包含 GetInvalidPathChars() 方法定义的一个或多个无效字符。

sourceFileNamedestinationFileNamenull

已关闭独立存储区。

已释放独立存储区。

未找到 sourceFileName

未找到 sourceFileName

已移除独立存储区。

  • 或 - 已禁用独立存储。

  • 或 - destinationFileName 已存在。

  • 或 - 发生了 I/O 错误。

注解

sourceFileName 并且 destinationFileName 必须指定不同的文件名。 IsolatedStorageFile.CopyFile(String, String, Boolean)使用方法重载覆盖现有文件。

另请参阅

适用于

CopyFile(String, String, Boolean)

将现有文件复制到新文件,还可以覆盖现有文件。

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

要复制的文件的名称。

destinationFileName
String

目标文件的名称。 不能是目录。

overwrite
Boolean

如果可以覆盖目标文件,则为 true;否则为 false

属性

例外

sourceFileNamedestinationFileName 是长度为零的字符串,仅包含空格,或包含 GetInvalidPathChars() 方法定义的一个或多个无效字符。

sourceFileNamedestinationFileNamenull

已关闭独立存储区。

已释放独立存储区。

未找到 sourceFileName

未找到 sourceFileName

已移除独立存储区。

  • 或 -

已禁用独立存储。

  • 或 -

发生了 I/O 错误。

注解

sourceFileName如果为 ,则destinationFileName具有相同的文件名overwritetrue

另请参阅

适用于