NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ArgIterator Structure

Represents a variable argument list. You can use this class to step through the argument list of a function that takes a variable number of arguments. It is very likely that most compilers will hide the complexity of ArgIterator under language syntax. See the example below.

Functions that require variable length argument lists are declared using the ellipsis (...) in the argument list.

Object
   ValueType
      ArgIterator

[Visual Basic]
Public Structure ArgIterator
[C#]
public struct ArgIterator
[C++]
public __value struct ArgIterator

[JScript] In JScript, you can use the structures in the NGWS frameworks, but you cannot define your own.

Remarks

[To be supplied.]

Requirements

Namespace: System

Assembly: mscorlib.dll

Example

Managed C++:

#import <mscorlib.dll>
#include <crt.h>
 
int sum(int numElements,...) {
  va_list args;
  va_start(args,
numElements); //Creates a new ArgIterator
 
  int sum = 0;
  int arg;
 
  for(int ct=0;ct <
numElements;ct++) {
      arg = va_arg(args,
int); //Calls ArgIterator::GetNextArg()
      Console::WriteLine
(L"Argument {0}: '{1}'", Int32::Box(ct),
 
Int32::Box(arg));
      sum += arg;
  }
  return sum;
}
 
int main() {
  int ret = sum(4, 40, 54,
20, 99);
  Console::WriteLine
(L"Sum is: {0}", Int32::Box(ret));
  return 1;
}

See Also

ArgIterator Members | System Namespace