Ejemplo n.º 1
0
    static void Main()
    {
        // find by attribute
        MethodInfo method =
            (from m in typeof(Program).GetMethods()
             where Attribute.IsDefined(m, typeof(FooAttribute))
             select m).First();

        TestMethod del = (TestMethod)Delegate.CreateDelegate(
            typeof(TestMethod), method);
        TestMetaData tmd = new TestMetaData(del, method.Name);

        tmd.Bar();
    }