次の方法で共有


ArgIterator コンストラクタ (RuntimeArgumentHandle)

指定した引数リストを使用して、ArgIterator 構造体の新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)

構文

'宣言
Public Sub New ( _
    arglist As RuntimeArgumentHandle _
)
'使用
Dim arglist As RuntimeArgumentHandle

Dim instance As New ArgIterator(arglist)
public ArgIterator (
    RuntimeArgumentHandle arglist
)
public:
ArgIterator (
    RuntimeArgumentHandle arglist
)
public ArgIterator (
    RuntimeArgumentHandle arglist
)
public function ArgIterator (
    arglist : RuntimeArgumentHandle
)

パラメータ

  • arglist
    必須の引数と省略可能な引数で構成される引数リスト。

解説

新しい ArgIterator オブジェクトは、最初の省略可能な引数から始まる引数リストを列挙します。

実装時の注意 このコンストラクタは、特に C/C++ プログラミング言語で使用するために用意されています。

使用例

ArgIterator コンストラクタのコード例を次に示します。

// This code example demonstrates the ArgIterator constructor.
using System;

public class Sample
{
public static void Main()
    {
    // Call a method with a variable argument list.
    int i=0;
    Test.printArg( (double)23.7, ref i, 
                   __arglist( typeof(int), "hello", UIntPtr.Zero ) );
    }
}

public class Test
{
    public unsafe static void printArg(double d, ref int i, __arglist)
    {

    // Get the argument list, starting at the first argument.
    ArgIterator args = new ArgIterator( __arglist, null);

/*
    // Get the argument list, starting at the first optional argument.
    ArgIterator args = new ArgIterator( __arglist );
*/

    // Display the type of each argument in the argument list.
    TypedReference tr;
    while(true)
        {
        try {
            tr = args.GetNextArg();
            Console.WriteLine( TypedReference.GetTargetType(tr) );
            }
        catch ( InvalidOperationException ) 
            { 
            break; 
            }
        }
    }
}

/* 
This code example produces the following results if you use 
"new ArgIterator( __arglist, null)":

System.Double
System.Int32
System.Type
System.String
System.UIntPtr

This code example produces the following results if you use 
the commented statement, "new ArgIterator(__arglist)":

System.Type
System.String
System.UIntPtr

*/

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

ArgIterator 構造体
ArgIterator メンバ
System 名前空間