[2019-12] [threads] Add back mono_threads_attach_tools_thread as a public API (#18074)
[mono-project.git] / mono / tests / vararg.cs
blobb192cf061786eee0898339f53569b7c958cc895c
1 using System;
3 class Class1
5 static int AddABunchOfInts (__arglist)
7 int result = 0;
9 System.ArgIterator iter = new System.ArgIterator (__arglist);
10 int argCount = iter.GetRemainingCount();
12 for (int i = 0; i < argCount; i++) {
13 System.TypedReference typedRef = iter.GetNextArg();
14 result += (int)TypedReference.ToObject( typedRef );
17 return result;
20 static int Main (string[] args)
22 int result = AddABunchOfInts ( __arglist ( 2, 3, 4 ));
23 Console.WriteLine ("Answer: {0}", result);
25 if (result != 9)
26 return 1;
28 return 0;