为什么没有SUM()扩展了IEnumerable&LT; UINT&GT; [英] Why is there no Sum() extension for IEnumerable<uint>
本文介绍了为什么没有SUM()扩展了IEnumerable&LT; UINT&GT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
似乎总和不定义的IEnumerable&LT; UINT&GT;
(和其他无符号整数,对于这个问题)
It seems that Sum is not defined for IEnumerable<uint>
(and other unsigned integers, for that matter)
var s = new int[] { 1, 2, 3 };
s.Sum(); //works fine
var us = new uint[] { 1, 2, 3 };
us.Sum(); //missing method
我想知道:
- 在我做了一些根本性的错误/误解的情况?
- 在什么样的设计决策,可能会导致遗漏
的IEnumerable&LT的; UINT&GT; .SUM()
推荐答案
只是一个猜测:因为UINT是不符合CLS。不知道这会权衡他们决定不支持它。
Just a guess: Because uint is not CLS-compliant. Not sure if that would weigh in their decision to not support it.
这篇关于为什么没有SUM()扩展了IEnumerable&LT; UINT&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文