Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TempFileCollection.AddExtension Method (String, Boolean)

Adds a file name with the specified file name extension to the collection, using the specified value indicating whether the file should be deleted or retained.

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

public string AddExtension(
	string fileExtension,
	bool keepFile
)

Parameters

fileExtension
Type: System.String

The file name extension for the auto-generated temporary file name to add to the collection.

keepFile
Type: System.Boolean

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

Return Value

Type: System.String
A file name with the specified extension that was just added to the collection.

ExceptionCondition
ArgumentException

fileExtension is null or an empty string.

This method returns a file name with the specified extension that has been added to the temporary files collection. Other code must still create the file before it can be used.

This method can be called only once for each file name extension, because it will return the same name if it is called with the same extension.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft