MethodHandle From C#
Posted by: IKVM.NET Weblog,
on 08 Aug 2011 |
View original | Bookmarked: 0 time(s)
using java.lang.invoke;classProgram {
static void Main() {
MethodType mt = MethodType.methodType(typeof(void), typeof(string), typeof(object[]));
MethodHandle mh = MethodHandles.lookup().findStatic(typeof(System.Console), "WriteLine",
mt);
mh.invoke("{0} {1}", "Hello", "World");
}
}
This now works, but it is not very efficient. Invoking a MethodHandle from Java is
more efficient, because the call site signature is statically known in that...