C#:
public static void Main(string[] args)
{
int result = Sum();
}
public static int Sum(List<int> numbers)
{
//List<int> numbers = new List<int>();
numbers.Add(3);
numbers.Add(2);
numbers.Add(6);
numbers.Add(-1);
numbers.Add(5);
numbers.Add(1);
return numbers.Sum();
}
}
}
what im i doing wrong?
the error is
Program.cs(10,20): error CS7036: There is no argument given that corresponds to the required formal parameter 'numbers' of 'Program.Sum(List<int>)' [C:\Users\mngar\Desktop\school\coding-exercises\part3\lists\exercise_76\exercise_76.csproj]
Program.cs(23,28): error CS1061: 'List<int>' does not contain a definition for 'Sum' and no accessible extension method 'Sum' accepting a first argument of type 'List<int>' could be found (are you missing a using directive or an assembly reference?) [C:\Users\mngar\Desktop\school\coding-exercises\part3\lists\exercise_76\exercise_76.csproj]
The build failed. Fix the build errors and run again.
Last edited: