Merge pull request #4998 from kumpera/fix_56684
[mono.git] / mono / tests / vararg.cs
1 using System;
2
3 class Class1
4 {
5         static int AddABunchOfInts (__arglist)
6         {
7                 int result = 0;
8
9                 System.ArgIterator iter = new System.ArgIterator (__arglist);
10                 int argCount = iter.GetRemainingCount();
11
12                 for (int i = 0; i < argCount; i++) {
13                         System.TypedReference typedRef = iter.GetNextArg();
14                         result += (int)TypedReference.ToObject( typedRef );
15                 }
16                 
17                 return result;
18         }
19
20         static int Main (string[] args)
21         {
22                 int result = AddABunchOfInts ( __arglist ( 2, 3, 4 ));
23                 Console.WriteLine ("Answer: {0}", result);
24
25                 if (result != 9)
26                         return 1;
27
28                 return 0;
29         }
30 }