Limitations to .NET Support
R2026b.NET Features Not Supported in MATLAB
MATLAB® supports the .NET features C# supports, with these exceptions:
Unloading a .NET Framework assembly. If you modify and rebuild it, you must restart MATLAB to access the new code.
To unload a .NET Core assembly, call the
NET.addAssemblyfunction with theUnloadableparameter set to true, then callNET.unloadAssembly. (since R2026a)Before R2025a: Saving (serializing) .NET objects into a MAT file.
Cannot use
ClassName.propertynamesyntax to set static properties. UseNET.setStaticPropertyinstead.Passing a structure array, sparse array, or complex number to a .NET property or method.
Subclassing .NET classes from MATLAB.
Accessing nonpublic class members.
Displaying generic methods using
methodsormethodsviewfunctions. For a workaround, see Display .NET Generic Methods Using Reflection.Creating an instance of a nested class. For a workaround, see Use .NET Nested Classes and Enumerations.
Creating .NET arrays with a specific lower bound.
Concatenating multiple .NET objects into an array.
Implementing interface methods.
Hosting .NET controls in figure windows.
Casting operations.
Calling constructors with
reforouttype arguments.Pointer type arguments, function pointers,
Dllimportkeyword..NET remoting.
Using the MATLAB
:(colon) operator in aforeachiteration.Adding event listeners to .NET events defined in static classes.
Handling .NET events with signatures that do not conform to the standard signature.
Creating empty .NET objects.
Creating .NET objects that do not belong to a namespace.
Limitations to Support of .NET Arrays
MATLAB does not support:
Arrays which specify a lower bound
Concatenating .NET objects into an array
The
endfunction as the last index in a .NET arrayArray indices of complex values
Autoconversion of
charor cell arrays to jagged array arguments.Autoconversion of MATLAB arrays to multidimensional jagged array arguments.
Limitations to Support of .NET Events
MATLAB only handles events with the standard signature of an event handler delegate
For example, an event handler in C# is a delegate with this signature:
public delegate void MyEventHandler(object sender, MyEventArgs e)The argument sender specifies the object that fired the event.
The argument e holds data that can be used in the event handler.
The class MyEventArgs is derived from the .NET class
EventArgs.
Limitations to Support of .NET Delegates
MATLAB does not support associating a delegate instance with a generic .NET method.
When calling a method asynchronously, be aware that:
MATLAB is a single-threaded application. Therefore, handling asynchronous calls in the MATLAB environment might result in deadlocks.
For the technique described in the Microsoft® .NET article Blocking Application Execution Using an AsyncWaitHandle, MATLAB does not support the use of the
WaitOne()method overload with no arguments. This technique is supported with Microsoft .NET Framework only.You cannot call
EndInvoketo wait for the asynchronous call to complete.
Limitations to Support of .NET Enumerations
You cannot create arrays of .NET enumerations, or any .NET objects, in MATLAB.