แก้ไข

แชร์ผ่าน


DynamicMethod.GetParameters Method

Definition

Returns the parameters of the dynamic method.

public:
 override cli::array <System::Reflection::ParameterInfo ^> ^ GetParameters();
public override System.Reflection.ParameterInfo[] GetParameters ();
override this.GetParameters : unit -> System.Reflection.ParameterInfo[]
Public Overrides Function GetParameters () As ParameterInfo()

Returns

An array of ParameterInfo objects that represent the parameters of the dynamic method.

Examples

The following code example displays the parameters of a dynamic method. This code example is part of a larger example provided for the DynamicMethod class.

// Display parameter information.
array<ParameterInfo^>^ parameters = hello->GetParameters();
Console::WriteLine("\r\nParameters: name, type, ParameterAttributes");
for each (ParameterInfo^ p in parameters)
{
    Console::WriteLine("\t{0}, {1}, {2}", 
        p->Name, p->ParameterType, p->Attributes);
}
// Display parameter information.
ParameterInfo[] parameters = hello.GetParameters();
Console.WriteLine("\r\nParameters: name, type, ParameterAttributes");
foreach( ParameterInfo p in parameters )
{
    Console.WriteLine("\t{0}, {1}, {2}",
        p.Name, p.ParameterType, p.Attributes);
}
' Display parameter information.
Dim parameters() As ParameterInfo = hello.GetParameters()
Console.WriteLine(vbCrLf & "Parameters: name, type, ParameterAttributes")
For Each p As ParameterInfo In parameters
    Console.WriteLine(vbTab & "{0}, {1}, {2}", _ 
        p.Name, p.ParameterType, p.Attributes)
Next p

Remarks

The ParameterInfo objects returned by this method are for information only. Use the DefineParameter method to set or change the characteristics of the parameters.

Applies to

See also