Skip to content

Instantly share code, notes, and snippets.

@rohinomiya
Created August 30, 2012 14:18
Show Gist options
  • Save rohinomiya/3529440 to your computer and use it in GitHub Desktop.
Save rohinomiya/3529440 to your computer and use it in GitHub Desktop.
C#で可変長引数を使うには params ref: http://qiita.com/items/b8327999fd835132cb7a
using System;
using System.Linq;
namespace SampleParams
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Sum={0}",Sum(1,2,3,4,5));
Console.ReadKey(true);
}
public static int Sum(params int [] values)
{
return values.Sum();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment