什么是Java的Dynamic Proxies的.Net等价物?
发布时间:2020-05-25 01:51:27 所属栏目:Java 来源:互联网
导读:在 java中,可以使用动态代理动态实现接口,如下所示: public static T T createProxy(InvocationHandler invocationHandler, ClassT anInterface) { if (!anInterface.isInterface()) { throw new IllegalArgumentExcepti
|
在 java中,可以使用动态代理动态实现接口,如下所示: public static <T> T createProxy(InvocationHandler invocationHandler,Class<T> anInterface) {
if (!anInterface.isInterface()) {
throw new IllegalArgumentException("Supplied interface must be an interface!");
}
return (T) Proxy.newProxyInstance(anInterface.getClassLoader(),new Class[]{anInterface},invocationHandler);
}
.Net中有等价物吗? 解决方法有几个库在.NET中实现这一点. Here’s a list of them,有基准.(编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
