c# - 在 MATLAB 中调用 .NET 通用类的静态方法?

标签 c# .net matlab generics

如何在 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/

相关文章:

c# - 在C#中的进程之间插入时间延迟

c# - 从 ASP.NET Core Web 应用访问类库中的 Entity Framework

c# - 消费者的 Amazon Kinesis KCL 客户端无法在 .NET 中运行

c# - 使用 XBAP 直接导航浏览器

相当于 MATLAB 的 robustfit 的 Java 或 C

c# - 从 C# .net 调用 python.py

c# - 我可以为 ASP.NET SOAP Web 服务设置一个可选参数吗

user-interface - 如何在 MATLAB 程序中使用 GUI/资源管理器窗口选择输入?

matlab - 如何为所有并行工作的 MATLAB session 强制使用 100% 的 CPU?

c# - 在 AWS Lambda For .net 上配置 CORS 响应 header