Export (0) Print
Expand All

ParameterModifier Structure

Attaches a modifier to parameters so that binding can work with parameter signatures in which the types have been modified.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

[SerializableAttribute]
[ComVisibleAttribute(true)]
public struct ParameterModifier

The ParameterModifier type exposes the following members.

  NameDescription
Public methodSupported by the XNA FrameworkParameterModifierInitializes a new instance of the ParameterModifier structure representing the specified number of parameters.
Top

  NameDescription
Public propertySupported by the XNA FrameworkItemGets or sets a value that specifies whether the parameter at the specified index position is to be modified by the current ParameterModifier.
Top

  NameDescription
Public methodSupported by the XNA FrameworkEqualsIndicates whether this instance and a specified object are equal. (Inherited from ValueType.)
Public methodSupported by the XNA FrameworkGetHashCodeReturns the hash code for this instance. (Inherited from ValueType.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by the XNA FrameworkToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)

In XNA Framework 3.0, this member is inherited from Object.ToString().
Top

The ParameterModifier structure is used with the Type.InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method overload when passing parameters by reference to a COM component that is accessed late bound. The parameters that are to be passed by reference are specified by a single ParameterModifier structure, which must be passed in an array containing a single element. The single ParameterModifier structure in this array must be initialized with the number of parameters in the member that is to be invoked. To indicate which of these parameters are passed by reference, set the value of the Item property (the indexer in C#) to true for the index number corresponding to the zero-based position of the parameter.

The following code example shows this for a member that has three string arguments, the first and third of which are passed by reference. Assume that a variable named obj contains a reference to the COM object.

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft