ParameterModifier 構造体

定義

型が変更されているパラメーター シグネチャでバインドを機能させるためにパラメーターに修飾子をアタッチします。

public value class ParameterModifier
public readonly struct ParameterModifier
public struct ParameterModifier
[System.Serializable]
public struct ParameterModifier
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct ParameterModifier
type ParameterModifier = struct
[<System.Serializable>]
type ParameterModifier = struct
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ParameterModifier = struct
Public Structure ParameterModifier
継承
ParameterModifier
属性

次のコード例は、3 つの文字列引数を持つメンバーに対してこれを示しています。そのうちの 1 番目と 3 番目は参照渡しです。 名前付きの obj 変数に COM オブジェクトへの参照が含まれていると仮定します。

// Create an array containing the arguments.
array<Object^>^ args = {"Argument 1", "Argument 2", "Argument 3" };

// Initialize a ParameterModifier with the number of parameters.
ParameterModifier p = ParameterModifier(3);

// Pass the first and third parameters by reference.
p[0] = true;
p[2] = true;

// The ParameterModifier must be passed as the single element
// of an array.

array<ParameterModifier>^ mods = { p };

// Invoke the method late bound.
obj->GetType()->InvokeMember("MethodName", BindingFlags::InvokeMethod,
     nullptr, obj, args, mods, nullptr, nullptr);
// Create an array containing the arguments.
object[] args = {"Argument 1", "Argument 2", "Argument 3" };

// Initialize a ParameterModifier with the number of parameters.
ParameterModifier p = new ParameterModifier(3);

// Pass the first and third parameters by reference.
p[0] = true;
p[2] = true;

// The ParameterModifier must be passed as the single element
// of an array.
ParameterModifier[] mods = { p };

// Invoke the method late bound.
obj.GetType().InvokeMember("MethodName", BindingFlags.InvokeMethod,
     null, obj, args, mods, null, null);
' Create an array containing the arguments.
Dim args As Object = {"Argument 1", "Argument 2", "Argument 3" }

' Initialize a ParameterModifier with the number of parameters.
Dim p As New ParameterModifier(3)

' Pass the first and third parameters by reference.
p(0) = True
p(2) = True

' The ParameterModifier must be passed as the single element
' of an array.
Dim mods() As ParameterModifier = { p }

' Invoke the method late bound.
obj.GetType().InvokeMember("MethodName", BindingFlags.InvokeMethod, _
     Nothing, obj, args, mods, Nothing, Nothing)

注釈

この ParameterModifier 構造体は、遅延バインドに Type.InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) アクセスされる COM コンポーネントへの参照によってパラメーターを渡すときに、メソッドのオーバーロードと共に使用されます。 参照によって渡されるパラメーターは、単一の構造体によって指定されます。これは、1 つの ParameterModifier 要素を含む配列に渡す必要があります。 この配列内の 1 つの ParameterModifier 構造体は、呼び出されるメンバー内のパラメーターの数で初期化する必要があります。 これらのパラメーターのうち、どのパラメーターが参照によって渡されているかを示すには、プロパティの Item[] 値 (C# のインデクサー) を true 、パラメーターの 0 から始まる位置に対応するインデックス番号に設定します。

コンストラクター

ParameterModifier(Int32)

指定されたパラメーター数を表す ParameterModifier 構造体の新しいインスタンスを初期化します。

プロパティ

Item[Int32]

指定したインデックス位置にあるパラメーターが現在の ParameterModifier によって変更されるかどうかを指定する値を取得または設定します。

適用対象