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?
- Is it to avoid overflow problems?
- 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>
精彩评论