Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
C# - a method that accepts an indefinite number of parameters
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; namespace Rextester { public class Program { public static int Sum(params int[] numbers) { int s=0; for (int i=0;i<numbers.Length;i++) { s += numbers[i]; } return s; } public static void Main(string[] args) { int x=Sum(9,7,8); int y=Sum(1,2,3,4); Console.WriteLine(x); Console.WriteLine(y); } } }
run
|
edit
|
history
|
help
0
NumsToVars
Pyramid using C#
two words are anagrams
Create RFReader HardwareConfig
Serialization
Interface referance variable
partial method
nested try catch
StackOverflowException
Remove Duplicate Ignore Case