[Mono-list] System.ArgIterator
Jeroen Frijters
jeroen@sumatra.nl
Tue, 26 Feb 2002 00:14:58 +0100
You use the arglist CIL instruction to create a RunTimeArgumentHandle.
Microsoft's C# compiler has (undocumented) support for this.
static int AddABunchOfInts1( __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 += __refvalue(typedRef, int);
}
return result;
}
And you call a vararg method using:
AddABunchOfInts1(__arglist(2, 3, 4));
Regards,
Jeroen
> -----Original Message-----
> From: mono-list-admin@ximian.com
> [mailto:mono-list-admin@ximian.com] On Behalf Of Duco Fijma
> Sent: Tuesday, February 26, 2002 00:13
> To: mono-list@ximian.com
> Subject: [Mono-list] System.ArgIterator
>
>
> Hi,
>
> The documentation of the -yet unimplemented- class
> System.ArgIterator looks deceptively simple. It does iterate
> a variable argument list. But how is it supposed to do this?
> There seems to be some (InternalCall??) magic behind it. The
> .NET FrameWork does not state how the arguments to the
> constructors are to be interpreted. The first parameter of
> each of the two constructors of ArgIterator is even of a type
> (RunTimeArgumentHandle) without any documented members.
>
> Duco
>
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-> list
>