.net核心:Assert支持C#.NET核心
答
你可以从check the API documentation,从那里你可以看到.NET Core 1.0和更新的版本,NetStandard 1.0和更新的版本都支持Debug.Assert(bool)
。
如果它不适合你,你可能需要在你的项目中包含NuGet软件包System.Diagnostics.Debug
以显示它。
谢谢斯科特。我是.net核心新手,刚刚导入了“Using System.Diagnostics.Debug”,并直接调用Assert()。我将其更改为“使用System.Diagnostics;”然后使用“Debug.Assert()”进行调用 – Anish