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。

适用于