Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

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

I would like to know:

  • Have I done something fundamentally wrong/misunderstood the situation?
  • What design decisions might cause the omission of IEnumerable<uint>.Sum()?

MSDN: Enumerable.Sum

like image 545
dss539 Avatar asked May 06 '10 21:05

dss539


1 Answers

Just a guess: Because uint is not CLS-compliant. Not sure if that would weigh in their decision to not support it.

like image 198
PatrickSteele Avatar answered Sep 22 '22 23:09

PatrickSteele