http://www.developer.com/net/csharp/article.php/3710176
params 키워드를 이용하여 메서드에 가변인자 전달하기.
params 키워드를 이용하여 메서드에 가변인자 전달하기.
public void ObjectParams(string Message, params object[] p)
{
Console.WriteLine(Message);
for (int i = 0; i < p.Length; i++) {
Console.WriteLine(p[i]);
}
}
ObjectParams("Variable Object Parameters", 12, 'z', "Test");
아니면 배열로 만들어 전달하기.int[] TestIntArray = new int[5] { 11, 12, 13, 14, 15 }; IntParams("Integer Array Parameter", TestIntArray);
'공부 해 Boa요. > C# & .NET' 카테고리의 다른 글
c# 과 .net ( 닷넷 ) 이란 무엇인가 ? (0) | 2008.01.11 |
---|