TempFileCollection.AddFile(String, Boolean) 메서드

정의

컬렉션이 삭제되거나 Delete() 메서드가 호출될 때 파일을 보관할 것인지 여부를 나타내는 특정 값을 사용하여 지정된 파일을 컬렉션에 추가합니다.

public:
 void AddFile(System::String ^ fileName, bool keepFile);
public void AddFile (string fileName, bool keepFile);
member this.AddFile : string * bool -> unit
Public Sub AddFile (fileName As String, keepFile As Boolean)

매개 변수

fileName
String

컬렉션에 추가할 파일 이름입니다.

keepFile
Boolean

파일을 사용한 후에 유지하려면 true로 설정하고, 삭제하려면 false로 설정합니다.

예외

fileNamenull 또는 빈 문자열인 경우

또는

fileName은(는) 중복됩니다.

예제

다음 예제에서는 메서드를 AddFile(String, Boolean) 사용하여 컬렉션에 보관할 파일을 추가하는 방법을 보여줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 TempFileCollection 클래스입니다.

// Name a file in the test directory.
string file2Name = "testDir\\test.txt";
// Add the file to the temp directory and indicate it is to be kept.
tfc.AddFile(file2Name, true);
' Name a file in the test directory.
Dim file2Name As String = "testDir\test.txt"
' Add the file to the temp directory and indicate it is to be kept.
tfc.AddFile(file2Name, True)

적용 대상