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 파일을 삭제해야 하는 경우

예외

fileName 이거나 null 빈 문자열입니다.

-또는-

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)

적용 대상