HostingEnvironmentExtensions.IsEnvironment 方法

定義

比較目前主控環境名稱與指定的值。 程式庫作者應避免使用此 API,如需詳細資料,請參閱備註。

public:
[System::Runtime::CompilerServices::Extension]
 static bool IsEnvironment(Microsoft::Extensions::Hosting::IHostingEnvironment ^ hostingEnvironment, System::String ^ environmentName);
public static bool IsEnvironment (this Microsoft.Extensions.Hosting.IHostingEnvironment hostingEnvironment, string environmentName);
static member IsEnvironment : Microsoft.Extensions.Hosting.IHostingEnvironment * string -> bool
<Extension()>
Public Function IsEnvironment (hostingEnvironment As IHostingEnvironment, environmentName As String) As Boolean

參數

hostingEnvironment
IHostingEnvironment

IHostingEnvironment 的執行個體。

environmentName
String

要對其進行驗證的環境名稱。

傳回

若指定名稱與目前環境相同,則為 true;否則為 false

備註

環境名稱通常專屬於應用程式。 設計用於許多不同的應用程式的連結庫應該避免將行為與特定環境名稱結合。

適用於