ConsoleLifetime 類別

定義

接聽 Ctrl+C 或 SIGTERM,並起始關機。

public ref class ConsoleLifetime : IDisposable, Microsoft::Extensions::Hosting::IHostLifetime
public class ConsoleLifetime : IDisposable, Microsoft.Extensions.Hosting.IHostLifetime
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public class ConsoleLifetime : IDisposable, Microsoft.Extensions.Hosting.IHostLifetime
type ConsoleLifetime = class
    interface IHostLifetime
    interface IDisposable
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
type ConsoleLifetime = class
    interface IHostLifetime
    interface IDisposable
Public Class ConsoleLifetime
Implements IDisposable, IHostLifetime
繼承
ConsoleLifetime
屬性
實作

備註

此 API 支援 .NET 基礎結構,並不適合直接從您的程式代碼使用。

建構函式

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>)

此 API 支援基礎結構,且不適合直接從程式碼使用。 此 API 可能會在未來的版本中變更或移除。

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>, ILoggerFactory)

此 API 支援基礎結構,且不適合直接從程式碼使用。 此 API 可能會在未來的版本中變更或移除。

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostingEnvironment, IApplicationLifetime)

此 API 支援基礎結構,且不適合直接從程式碼使用。 此 API 可能會在未來的版本中變更或移除。

方法

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
StopAsync(CancellationToken)

StopAsync(CancellationToken) 呼叫以指出主機正在停止中,且現在即可關機。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
WaitForStartAsync(CancellationToken)

在的 StartAsync(CancellationToken)開頭呼叫 ,這會等到它完成,再繼續。 這可用來將啟動延遲到外部事件發出訊號為止。

適用於