[mono-api-info] Use XmlWriter instead of XmlDocument to make this faster.
[mono-project.git] / mono / tests / vararg2.cs
blob0bb9091f53a93fff544b3fe79d4b54e2bbf189d2
1 using System;
3 public class main {
4 static int AddABunchOfShorts (__arglist)
6 int result = 0;
8 System.ArgIterator iter = new System.ArgIterator (__arglist);
9 int argCount = iter.GetRemainingCount();
11 for (int i = 0; i < argCount; i++) {
12 System.TypedReference typedRef = iter.GetNextArg();
13 result += (short)TypedReference.ToObject( typedRef );
16 return result;
19 static int AddABunchOfBytes (__arglist)
21 int result = 0;
23 System.ArgIterator iter = new System.ArgIterator (__arglist);
24 int argCount = iter.GetRemainingCount();
26 for (int i = 0; i < argCount; i++) {
27 System.TypedReference typedRef = iter.GetNextArg();
28 result += (byte)TypedReference.ToObject( typedRef );
31 return result;
34 public static int Main () {
35 if (AddABunchOfShorts (__arglist ((short)1, (short)2, (short)3)) != 6)
36 return 1;
38 if (AddABunchOfBytes (__arglist ((byte)4, (byte)5, (byte)6)) != 15)
39 return 2;
41 return 0;