MATLAB 中的 .NET 事件和委托
R2026a使用 .NET 事件回调、创建和调用 .NET 委托
通过委托可以告知 C# 当事件触发时调用哪个方法。事件是由 .NET 给出的告知某操作已发生的通知。下列主题说明如何在 MATLAB® 中使用 .NET 事件和委托。
函数
BeginInvoke | 启动异步 .NET 委托调用 |
EndInvoke | 检索 .NET System.Delegate BeginInvoke 方法启动的异步调用结果 |
Combine | 静态 .NET System.Delegate Combine 方法 |
Remove | 静态 .NET System.Delegate Remove 方法 |
RemoveAll | 静态 .NET System.Delegate RemoveAll 方法 |
主题
- Use .NET Events in MATLAB
These examples use the
addlistenerfunction 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.
- 事件和侦听程序的概述
使用事件和侦听程序发送和响应消息。
- .NET Delegates
In .NET, a delegate is a type that defines a method signature.
- .NET Delegates With out and ref Type Arguments
The MATLAB rules for mapping
outandreftypes for delegates are the same as for methods. - Call .NET Methods Asynchronously
How MATLAB handles asynchronous method calls.
疑难解答