Main Content

Strongly Typed Interface for C#

A strongly typed interface enforces a strict data type mapping between two programming languages. Use a strongly typed interface to generate C# code for MATLAB® functions and classes to use in .NET applications. When you build a C# application with this code, you can use MATLAB functions and classes as C# functions and classes without writing C# code. For more information, see Write MATLAB Code for Strongly Typed C# Interface.

To generate the C# code, call the matlab.engine.typedinterface.generateCSharp function. The function reads the type and validation data from MATLAB function and class definitions and creates corresponding C# source code. For details, see Data Type Mappings Between .NET and Strongly Typed MATLAB Code.

When to Use a C# Strongly Typed Interface

If you build C# engine applications and work with object-oriented data using the feval function, a strongly typed interface lets you call the MATLAB functions and classes by their MATLAB names in C# as if they were native C# functions and classes.

For more information, see Limitations of Strongly Typed Interface for C#.

See Also

Related Topics