c# – 如果列表返回空显示消息

c# – 如果列表返回空显示消息,第1张

概述使用MVC我将一个Projects列表传递给视图. @if (Model.Projects != null && Model.Projects.Count > 0){<fieldset> <table class="items" summary="@T("This is a table of the delivery Runs in your application")"> 使用MVC我将一个Projects列表传递给视图.

@if (Model.Projects != null && Model.Projects.Count > 0){<fIEldset>    <table  summary="@T("This is a table of the delivery Runs in your application")">        <colgroup>}else{//no data available}

Model.Projects.Count> 0说:

operator > cant be applIEd to operands of type ‘method group’ and
‘int’

解决方法 怎么样

Model.Projects.Count()> 0

要么

Model.Projects.Any()

如果你使用resharper,它会推荐你使用Model.Projects.Any()

总结

以上是内存溢出为你收集整理的c# – 如果列表返回显示消息全部内容,希望文章能够帮你解决c# – 如果列表返回空显示消息所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/langs/1222597.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-05
下一篇2022-06-05

发表评论

登录后才能评论

评论列表(0条)

    保存