Class TempFile
Generates a globally unique temporary file name and then ensures that the file is removed when the instance is disposed.
Namespace: Neon.IO
Assembly: Neon.Common.dll
Syntax
public sealed class TempFile
Constructors
TempFile(string, string)
Constructor.
Declaration
public TempFile(string suffix = null, string folder = null)
Parameters
Type | Name | Description |
---|---|---|
string | suffix | Optionally specifies the file suffix (including the leading period) to be appended to the generated file name. This defaults to .tmp. |
string | folder | Optionally specifies the target folder. This defaults to the standard temporary directory for the current user. |
Properties
Name
Returns the file name only.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Path
Returns the fully qualified path to the temporary file.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
string |
Root
Optionally specifies the root directory where the temporary files will
be created. This defaults to GetTempPath()
when this is null
or empty and can be overridden for specific
instances by passing a folder path the the constructor.
Declaration
public static string Root { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |