本文整理匯總了VB.NET中System.Reflection.ParameterInfo.ParameterType屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ParameterInfo.ParameterType屬性的具體用法?VB.NET ParameterInfo.ParameterType怎麽用?VB.NET ParameterInfo.ParameterType使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Reflection.ParameterInfo
的用法示例。
在下文中一共展示了ParameterInfo.ParameterType屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: parminfo
' 導入命名空間
Imports System.Reflection
Class parminfo
Public Shared Sub mymethod(int1m As Integer, ByRef str2m As String, _
ByRef str3m As String)
str2m = "in mymethod"
End Sub
Public Shared Function Main() As Integer
Console.WriteLine(ControlChars.CrLf + "Reflection.Parameterinfo")
'Get the ParameterInfo parameter of a function.
'Get the type.
Dim Mytype As Type = GetType(parminfo)
'Get and display the method.
Dim Mymethodbase As MethodBase = Mytype.GetMethod("mymethod")
Console.Write(ControlChars.CrLf _
+ "Mymethodbase = " + Mymethodbase.ToString())
'Get the ParameterInfo array.
Dim Myarray As ParameterInfo() = Mymethodbase.GetParameters()
'Get and display the ParameterInfo of each parameter.
Dim Myparam As ParameterInfo
For Each Myparam In Myarray
Console.Write(ControlChars.CrLf _
+ "For parameter # " + Myparam.Position.ToString() _
+ ", the ParameterType is - " + Myparam.ParameterType.ToString())
Next Myparam
Return 0
End Function
End Class
輸出:
Reflection.Parameterinfo Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef) For parameter # 0, the ParameterType is - System.Int32 For parameter # 1, the ParameterType is - System.String& For parameter # 2, the ParameterType is - System.String&