RenamedEventArgs.OldFullPath 屬性

定義

取得受影響檔案或目錄先前的完整路徑。

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

屬性值

受影響檔案或目錄的先前完整路徑。

範例

下列範例示範 OldFullPath 屬性。 此程式代碼範例是針對 類別提供的較大範例的 RenamedEventArgs 一部分。

//  This method is called when a file is renamed.
private static void OnRenamed(object source, RenamedEventArgs e)
{
    //  Show that a file has been renamed.
    WatcherChangeTypes wct = e.ChangeType;
    Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString());
}
' This method is called when a file is renamed.
Private Sub OnRenamed(ByVal source As Object, ByVal e As RenamedEventArgs)

    ' Show that a file has been renamed.
    Dim wct As WatcherChangeTypes = e.ChangeType
    Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString())
End Sub

備註

這個屬性會傳回使用 初始化的相同路徑 FileSystemWatcher ,即使它是相對路徑也一樣。

適用於