[Mono-list] MethodInfo Reflection

Matthew Metnetsky met@uberstats.com
Fri, 03 Sep 2004 13:22:07 -0400


I have a piece of code that is supposed to take any method and reflect
on and then invoke.  At the moment I'm trying to use
System.IO.DirectoryInfo.GetDirectories() which happens to be overloaded
once (search criteria).  I'm trying to following code to specify which I
want, but Type.GetMethod() keeps returning null.  What might I be doing
wrong below?

~ Matthew

================
using System;
using System.IO;
using System.Reflection;

public class Test
{
    public static void Main(string[] args)
    {
        Type type = typeof(DirectoryInfo);

        MethodInfo m = type.GetMethod("GetDirectories",
                                      new Type[1] {typeof(void)});
        Console.WriteLine(m); // returns null !
    }
}
====