diff options
author | Martin Baulig <martin@novell.com> | 2004-06-08 06:34:51 +0400 |
---|---|---|
committer | Martin Baulig <martin@novell.com> | 2004-06-08 06:34:51 +0400 |
commit | 3cd93d228c0fb576f4c80fbaa358244d2f8fc5d3 (patch) | |
tree | 257bfd72b9a145fd4f4bcdcc55d699b89595a03f /mcs/tests/test-269.cs | |
parent | 7da009db81a35a0a3ec584a261dedd74e7ac0a8b (diff) |
2004-06-08 Martin Baulig <martin@ximian.com>
* test-269.cs: New test for varargs methods.
svn path=/trunk/mcs/; revision=29004
Diffstat (limited to 'mcs/tests/test-269.cs')
-rw-r--r-- | mcs/tests/test-269.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mcs/tests/test-269.cs b/mcs/tests/test-269.cs new file mode 100644 index 00000000000..b192cf06178 --- /dev/null +++ b/mcs/tests/test-269.cs @@ -0,0 +1,30 @@ +using System; + +class Class1 +{ + static int AddABunchOfInts (__arglist) + { + int result = 0; + + System.ArgIterator iter = new System.ArgIterator (__arglist); + int argCount = iter.GetRemainingCount(); + + for (int i = 0; i < argCount; i++) { + System.TypedReference typedRef = iter.GetNextArg(); + result += (int)TypedReference.ToObject( typedRef ); + } + + return result; + } + + static int Main (string[] args) + { + int result = AddABunchOfInts ( __arglist ( 2, 3, 4 )); + Console.WriteLine ("Answer: {0}", result); + + if (result != 9) + return 1; + + return 0; + } +} |