ParameterInfo.Attributes gets the attributes for this parameter. : ParameterInfo « Reflection « VB.Net






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

1.ParameterInfo.GetCustomAttributes gets all the custom attributes defined on this parameter.
2.ParameterInfo.IsDefined
3.ParameterInfo.IsOut Property tells whether this is an output parameter.
4.ParameterInfo.Name Property returns the name of the parameter.
5.ParameterInfo.ParameterType Property gets the Type of this parameter.