本文整理汇总了VB.NET中System.Reflection.MethodInfo.GetGenericMethodDefinition方法的典型用法代码示例。如果您正苦于以下问题:VB.NET MethodInfo.GetGenericMethodDefinition方法的具体用法?VB.NET MethodInfo.GetGenericMethodDefinition怎么用?VB.NET MethodInfo.GetGenericMethodDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了MethodInfo.GetGenericMethodDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Generic
' Define a class with a generic method.
Public Class Example
Public Shared Sub Generic(Of T)(ByVal toDisplay As T)
Console.WriteLine(vbCrLf & "Here it is: {0}", toDisplay)
End Sub
End Class
示例2: arguments
' Create a Type object representing class Example, and
' get a MethodInfo representing the generic method.
'
Dim ex As Type = GetType(Example)
Dim mi As MethodInfo = ex.GetMethod("Generic")
DisplayGenericMethodInfo(mi)
' Assign the Integer type to the type parameter of the Example
' method.
'
Dim arguments() As Type = { GetType(Integer) }
Dim miConstructed As MethodInfo = mi.MakeGenericMethod(arguments)
DisplayGenericMethodInfo(miConstructed)
示例3:
' Get the generic type definition from the constructed method,
' and show that it's the same as the original definition.
'
Dim miDef As MethodInfo = miConstructed.GetGenericMethodDefinition()
Console.WriteLine(vbCrLf & "The definition is the same: {0}", _
miDef Is mi)