FileSystemEventArgs.Name Property


Gets the name of the affected file or directory.

 property System::String ^ Name { System::String ^ get(); };
public string? Name { get; }
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

Property Value

The name of the affected file or directory.


The name returned by the Name property is the relative path of the affected file or directory, with respect to the directory being watched. For example, if a FileSystemWatcher object is watching the directory "C:\temp" and the file at "C:\temp\test\file.txt" changes, the Name property will return "test\file.txt".

The Name property may be null for renamed events if the FileSystemWatcher does not get matching old and new name events from the OS.

Applies to