Mega Code Archive

 
Categories / VB.Net / Reflection
 

Type GetMethod with modifiers, binding constraints and calling convention

Imports System Imports System.Reflection Imports System.Runtime.InteropServices Class Program     Public Overloads Sub MethodA(ByVal i As Integer, ByVal l As Long)     End Sub     Public Overloads Sub MethodA(ByVal i() As Integer)     End Sub     Public Overloads Sub MethodA(ByRef r As Integer)     End Sub     Public Overloads Sub MethodA(ByVal i As Integer, <Out()> ByRef o As Integer)         o = 100     End Sub     Public Shared Sub Main(ByVal args() As String)         Dim mInfo As MethodInfo         mInfo = GetType(Program).GetMethod("MethodA", _             BindingFlags.Public Or BindingFlags.Instance, _             Nothing, _             CallingConventions.Any, _             New Type() {GetType(System.Int32), _             GetType(System.Int64)}, _             Nothing)         Console.WriteLine("Found method: {0}", mInfo)     End Sub End Class