以下是“什么是...”和“如何使用...”之间的区别:
<environment include="...">...
并且
<environment names="...">...
官方文档对我来说并没有帮助区分它们:
ASP.NET Core 中的环境标签助手
names
... If any of the provided environment names match the current environment, the enclosed content is rendered ... Environment values are compared to the current value returned by IWebHostEnvironment.EnvironmentName
The content is rendered if the hosting environment is Staging or Production
<environment names="Staging,Production"> <strong>IWebHostEnvironment.EnvironmentName is Staging or Production</strong> </environment>
include
The include property exhibits similar behavior to the names attribute. An environment listed in the include attribute value must match the app's hosting environment (IWebHostEnvironment.EnvironmentName) to render the content of the tag.
<environment include="Staging,Production"> <strong>IWebHostEnvironment.EnvironmentName is Staging or Production</strong> </environment>
甚至他们的代码片段都使用完全相同的自我描述:“IWebHostEnvironment.EnvironmentName is Staging or Production”。
它们之间有什么区别?