ParameterModifier 構造体
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
型が変更されたパラメーター シグネチャをバインドで使用できるように、パラメーターに修飾子をアタッチします。
public value class ParameterModifier
[System.Serializable]
public struct ParameterModifier
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct ParameterModifier
public struct ParameterModifier
public readonly struct ParameterModifier
[<System.Serializable>]
type ParameterModifier = struct
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ParameterModifier = struct
type ParameterModifier = struct
Public Structure ParameterModifier
- 継承
- 属性
例
次のコード例は、3 つの文字列引数を持つメンバーに対してこれを示しています。1 番目と 3 番目は参照渡しです。
objという名前の変数に COM オブジェクトへの参照が含まれているとします。
// 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構造体は、遅延バインドにアクセスされる COM コンポーネントへの参照によってパラメーターを渡すときに、Type.InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) メソッドのオーバーロードと共に使用されます。 参照によって渡されるパラメーターは、単一の ParameterModifier 構造体によって指定されます。この構造体は、1 つの要素を含む配列で渡す必要があります。 この配列内の 1 つの ParameterModifier 構造体は、呼び出されるメンバー内のパラメーターの数で初期化する必要があります。 これらのパラメーターのうち、どのパラメーターが参照渡しであるかを示すには、 Item[] プロパティ (C# のインデクサー) の値を、パラメーターの 0 から始まる位置に対応するインデックス番号の true に設定します。
コンストラクター
| 名前 | 説明 |
|---|---|
| ParameterModifier(Int32) |
指定した数のパラメーターを表す ParameterModifier 構造体の新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| Item[Int32] |
指定したインデックス位置のパラメーターを現在の ParameterModifierで変更するかどうかを指定する値を取得または設定します。 |