如何在 MATLAB 中调用 .NET 泛型类的静态方法?
例如,我将如何调用如下所示的静态方法Create
?
public class A<T> {
internal A() {
}
public static A<T> Create() {
return new A<T>();
}
}
http://www.mathworks.com/help/techdoc/matlab_external/brz16z_-1.html讨论了调用泛型类的静态泛型方法,但没有显示如何调用泛型类的静态非泛型方法。
最佳答案
所以在您拥有的链接上,它说:
Invoke Generic Functions of a Generic Class If a generic method uses the same parameterized type as the generic class, you can call the function directly on the class object. If the generic uses a different type than the class, use the NET.invokeGenericMethod function.
看来你应该能够做到:
genClsDef = NET.GenericClass('A','System.Double');
ret = NET.invokeGenericMethod(genClsDef,'A','System.Double');
关于c# - 在 MATLAB 中调用 .NET 通用类的静态方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10607656/