共用方式為


HostingEnvironmentExtensions.IsEnvironment 方法

定義

比較目前主控環境名稱與指定的值。

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

參數

hostingEnvironment
IHostingEnvironment

IHostingEnvironment 的執行個體。

environmentName
String

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

傳回

如果指定的名稱與目前環境相同,則為 True,否則為 false。

適用於