Created
August 30, 2012 14:18
-
-
Save rohinomiya/3529440 to your computer and use it in GitHub Desktop.
C#で可変長引数を使うには params ref: http://qiita.com/items/b8327999fd835132cb7a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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