TempFileCollection Constructor (String, Boolean)
Collapse the table of content
Expand the table of content

TempFileCollection Constructor (String, Boolean)


Initializes a new instance of the TempFileCollection class using the specified temporary directory and specified value indicating whether to keep or delete the temporary files after their generation and use, by default.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

public TempFileCollection(
	string tempDir,
	bool keepFiles


Type: System.String

A path to the temporary directory to use for storing the temporary files.

Type: System.Boolean

true if the temporary files should be kept after use; false if the temporary files should be deleted.

The value of keepFiles is used to set the KeepFiles parameter. The temporary files in the collection are retained or deleted upon the completion of compiler activity based on the value of the KeepFiles property in the collection. As each file is added to the collection, the current value of KeepFiles is associated with it, unless it is added with a method that has a keepFile parameter, in which case that value is used for that specific file. When the Delete method is called, if KeepFiles is true, all files are deleted, including those added with a KeepFiles value of true. This allows specific files, those identified as being keep files, to be temporarily retained after compilation for purposes such as error reporting, then deleted when they are no longer needed.


for full trust for the immediate caller. This class cannot be used by partially trusted code.

.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft