26.249. Class FileExt

Namespace: ArmoniK.Core.Common.Utils
Assembly: ArmoniK.Core.Common.dll

Provides extension methods for file operations, including moving and deleting files with additional safety and error handling.

public static class FileExt

26.249.1. Inheritance

objectFileExt

26.249.2. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

26.249.3. Methods

26.249.3.1. MoveOrDelete(string, string)

Try moving file from source into destination. If destination already exists, it will not be overwritten, and source will be deleted.

public static bool MoveOrDelete(string sourceFilename, string destinationFilename)

26.249.3.1.1. Parameters

sourceFilename string

The name of the file to move. Can include a relative or absolute path.

destinationFilename string

The new path and name for the file.

26.249.3.1.2. Returns

bool

Whether the file has been moved

26.249.3.2. TryDelete(string)

Try deleting a file. Do not throw any error in case the file does not exist (eg: already deleted)

public static bool TryDelete(string path)

26.249.3.2.1. Parameters

path string

Path of the file to delete

26.249.3.2.2. Returns

bool

Whether the file has been deleted