New course! Every coder should learn Generative AI!
Try a free lesson0
What do Min(), Max() & Sum() methods return if the elements are of a non-numeric type?
3 Answers
+ 4
Min() returns ths string/character with the lowest ASCII value. Max returns the one with the highest. Sum() doesn't have an overload for string[] or char[].
I'm not sure what they would do with any other types, though...
+ 1
are you sure that the language is c#?
in PHP the return of sum, is 0, if all array elements are non-numeric.
0
Yes these are defined array methods in C#. I have done some experiments with char arrays. Min and Max are defined by unicode sort order, but Sum produces a compilation error.