RenamedEventArgs.OldFullPath 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得受影響檔案或目錄先前的完整路徑。
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
,即使它是相對路徑也一樣。