다음을 통해 공유


ParameterModifier 구조체

형식이 수정된 매개 변수 서명에 바인딩이 작동하도록 매개 변수에 한정자를 첨부합니다.

네임스페이스: System.Reflection
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Structure ParameterModifier
‘사용 방법
Dim instance As ParameterModifier
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public struct ParameterModifier
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public value class ParameterModifier
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class ParameterModifier extends ValueType
JScript에서는 구조체를 사용할 수 있지만 새로 선언할 수는 없습니다.

설명

ParameterModifier 구조체는 Type.InvokeMember 메서드 오버로드와 함께 사용됩니다. 이때 매개 변수는 런타임에 바인딩하여 액세스되는 COM 구성 요소에 대한 참조로 전달됩니다. 참조로 전달되는 매개 변수는 단일 ParameterModifier 구조체로 지정되며 이 구조체는 단일 요소가 들어 있는 배열 형식으로 전달되어야 합니다. 이 배열의 단일 ParameterModifier 구조체는 호출할 멤버의 매개 변수 개수를 사용하여 초기화되어야 합니다. 참조로 전달되는 매개 변수를 나타내려면 매개 변수의 위치(0부터 시작)에 해당하는 인덱스 번호에 대해 Item 속성 값(C#의 경우 인덱서)을 true로 설정합니다.

다음 Visual Basic 및 C# 코드에서는 세 개의 문자열 인수를 사용하는 멤버에 대해 이 동작을 보여 줍니다. 첫 번째와 세 번째 인수는 참조로 전달됩니다. obj 변수에는 COM 개체에 대한 참조가 들어 있는 것으로 가정합니다.

    ' 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)
    // 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);

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

ParameterModifier 멤버
System.Reflection 네임스페이스