本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

MATLAB 中的 .NET 事件和委托

使用 .NET 事件回调、创建和调用 .NET 委托

通过委托可以告知 C# 当事件触发时调用哪个方法。事件是由 .NET Framework 给出的告知某操作已发生的通知。下列主题说明如何在 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 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.

事件和侦听程序概述

使用事件和侦听程序发送和响应消息。

.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.

疑难解答

Limitations to Support of .NET Events

.NET features not supported in MATLAB.

Limitations to Support of .NET Delegates

.NET features not supported in MATLAB.