ServiceController.Refresh Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Refreshes property values by resetting the properties to their current values.
public:
void Refresh();
public void Refresh ();
member this.Refresh : unit -> unit
Public Sub Refresh ()
Examples
The following example demonstrates the use of the Refresh method to obtain the status of a service. The code instructs a service to pause, and then waits for the status to reflect the change. This example is part of a larger example that is provided for the ServiceController class.
sc.Pause();
while (sc.Status != ServiceControllerStatus.Paused)
{
Thread.Sleep(1000);
sc.Refresh();
}
Console.WriteLine("Status = " + sc.Status);
sc.Pause()
While sc.Status <> ServiceControllerStatus.Paused
Thread.Sleep(1000)
sc.Refresh()
End While
Console.WriteLine("Status = " + sc.Status.ToString())
Remarks
The Refresh method causes the ServicesDependedOn, DependentServices, and Status properties to be reset to their current values when they are next referenced.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應