本文介绍了Linq到实体组的错误“尝试除以零”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 let value2 = Grp.Count(x => x.Column1 <= 2 && x.Column2== "studentName") * 100 / Grp.Count(x => x.Column2== "studentName") 在本声明中,有时分隔符为空因此它传递NaN值我怎样才能将分隔符从0更换为1. 我尝试了什么: let value2 = Grp.Count(x => x.Column1< = 2&& x.Column2 ==studentName)* 100 / Grp.Count(x = > x.Column2 ==studentName) 在本声明中有时候是分隔符是空的,所以它通过NaN值我怎么能r将分隔符从0到1放置。In this Statement some times the divider is Null so it pass NaN value how can I replace the divider from 0 to 1.What I have tried:let value2 = Grp.Count(x => x.Column1 <= 2 && x.Column2== "studentName") * 100 / Grp.Count(x => x.Column2== "studentName")In this Statement some times the divider is Null so it pass NaN value how can I replace the divider from 0 to 1.推荐答案 Math.Max(Grp.Count(x => x.Column2== "studentName"), 1) 这篇关于Linq到实体组的错误“尝试除以零”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-23 02:47