Main Content

.NET Events and Delegates in MATLAB

Use .NET event callbacks, create and call .NET delegates

A delegate is a way to tell C# which method to call when an event is triggered. An event is a notification by the .NET framework that an action has occurred. These topics show how to use .NET events and delegates in MATLAB®.

Functions

BeginInvokeInitiate asynchronous .NET delegate call
EndInvokeRetrieve result of asynchronous call initiated by .NET System.Delegate BeginInvoke method
CombineConvenience function for static .NET System.Delegate Combine method
RemoveConvenience function for static .NET System.Delegate Remove method
RemoveAllConvenience function for static .NET System.Delegate RemoveAll method

Topics

Use .NET Events in MATLAB

These examples use the addlistener function to handle .NET events with MATLAB callbacks.

Call .NET Delegates in MATLAB

This example shows you how to use a delegate in MATLAB.

Create Delegates from .NET Object Methods

This example shows how to create a delegate.

Create Delegate Instances Bound to .NET Methods

This example shows how to use delegate instances.

Combine and Remove .NET Delegates

This example shows how to manage delegates.

Overview Events and Listeners

Use events and listeners to send and respond to messages.

.NET Delegates

In the .NET Framework, a delegate is a type that defines a method signature.

.NET Delegates With out and ref Type Arguments

The MATLAB rules for mapping out and ref types for delegates are the same as for methods.

Calling .NET Methods Asynchronously

How MATLAB handles asynchronous method calls.

Troubleshooting

Limitations to Support of .NET Events

.NET features not supported in MATLAB.

Limitations to Support of .NET Delegates

.NET features not supported in MATLAB.