本文整理汇总了VB.NET中System.Reflection.ParameterInfo.Name属性的典型用法代码示例。如果您正苦于以下问题:VB.NET ParameterInfo.Name属性的具体用法?VB.NET ParameterInfo.Name怎么用?VB.NET ParameterInfo.Name使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Reflection.ParameterInfo
的用法示例。
在下文中一共展示了ParameterInfo.Name属性的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 = 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 name of each parameter.
Dim Myparam As ParameterInfo
For Each Myparam In Myarray
Console.Write(ControlChars.CrLf _
+ "For parameter # " + Myparam.Position.ToString() _
+ ", the Name is - " + Myparam.Name)
Next Myparam
Return 0
End Function
End Class
输出:
Reflection.ParameterInfo Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef) For parameter # 0, the Name is - int1m For parameter # 1, the Name is - str2m For parameter # 2, the Name is - str3m