0
Why cannot I assign the value of the sum of the integer elements of an array(taken as a argument in a function) to a variable ?
I am using a function that takes an array as a argument and then assign the value of the sum of the elements by (y=<array name> . Sum) . But it is not working. It is showing error saying "cannot convert method group Sum to non delegate int".why ???? I know how to find the sum in different ways but why is this method not working?
1 Réponse
+ 3
int[] arr = {10, 20, 30, 40, 50};
int r = arr.Sum();
Console.WriteLine(r);
Did you call the `Sum` method like that?