ParameterInfo.Attributes gets the attributes for this parameter.
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public Class MyClass1
Public Function MyMethod(i As Integer, ByRef j As Short, ByRef k As Long) As Integer
j = 2
Return 0
End Function
End Class
Public Class ParameterInfo_Attributes
Public Shared Sub Main()
Dim myType As Type = GetType(MyClass1)
Dim myMethodBase As MethodBase = myType.GetMethod("MyMethod")
Dim myParameters As ParameterInfo() = myMethodBase.GetParameters()
Console.WriteLine(myParameters.Length)
Dim i As Integer
For i = 0 To myParameters.Length - 1
Console.WriteLine("The {0} parameter has the attribute : {1}", i + 1, myParameters(i).Attributes)
Next i
End Sub
End Class
Related examples in the same category