本文整理匯總了VB.NET中System.Reflection.ParameterInfo.Attributes屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ParameterInfo.Attributes屬性的具體用法?VB.NET ParameterInfo.Attributes怎麽用?VB.NET ParameterInfo.Attributes使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Reflection.ParameterInfo
的用法示例。
在下文中一共展示了ParameterInfo.Attributes屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MyClass1
' 導入命名空間
Imports System.Reflection
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 'MyMethod
End Class
Public Class ParameterInfo_Attributes
Public Shared Sub Main()
' Get the type.
Dim myType As Type = GetType(MyClass1)
' Get the method named 'MyMethod' from the type.
Dim myMethodBase As MethodBase = myType.GetMethod("MyMethod")
' Get the parameters associated with the method.
Dim myParameters As ParameterInfo() = myMethodBase.GetParameters()
Console.WriteLine(ControlChars.Cr + "The method {0} has the {1} parameters :", "ParameterInfo_Example.MyMethod", myParameters.Length)
' Print the attributes associated with each of the parameters.
Dim i As Integer
For i = 0 To myParameters.Length - 1
Console.WriteLine(ControlChars.Tab + "The {0} parameter has the attribute : {1}", i + 1, myParameters(i).Attributes)
Next i
End Sub
End Class