开发者

Why no linq for byte, uint?

开发者 https://www.devze.com 2023-03-12 09:01 出处:网络
Enumerable.Sum() is only defined for IEnumerable where T in double, double? int, int? decimal, decimal? long,

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

精彩评论

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