using java.lang.invoke;class Program {
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 case. Read more: IKVM blog
QR:
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 case. Read more: IKVM blog
QR:
0 comments:
Post a Comment