本文整理汇总了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