Why don't these methods work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why don't these methods work?

"int[ ] arr = { 2, 4, 7, 1}; Console.WriteLine(arr.Max()); //Outputs 7 Console.WriteLine(arr.Min()); //Outputs 1 Console.WriteLine(arr.Sum()); //Outputs 14" These are from the C# SoloLearn tutorial and in the CodePlayground they work. Yet in my IDE throws an error for all three of them.

11th Mar 2017, 9:57 PM
Eric
3 Answers
+ 2
Min, Max and Sum require Linq extension. Try to add this using System.Linq;
11th Mar 2017, 10:29 PM
AtoMX
AtoMX - avatar
+ 1
I use SharpDelevop. Thanks Atomx!
11th Mar 2017, 10:46 PM
Eric
- 1
what kind of error? Are you using Visual Studio?
11th Mar 2017, 10:27 PM
Edi Lipovac
Edi Lipovac - avatar