开发者

Why no linq for byte, uint?

Enumerable.Sum() is only defined for IEnumerable where T in

double, double? int, int? decimal, decimal? long, long? float, float?

Is there a reason for not defining for byte, short or uint?

  1. Is it to avoid overflow problems?
  2. Or does it make type 开发者_开发技巧inference difficult for compiler? (Most Likely)


Because when you add a short and a short the outcome can be handled by an int. Could be some CLS compliant issues as well. This was posted as a similiar question:

Why is there no Sum() extension for IEnumerable<uint>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜