C# - System.Action

.net 内置的一种委托

复制代码
using System;
private Action m_Action;
m_Action = Func1;
m_Action += Func1;
m_Action += Func2;

m_Action?.invoke()

//获取委托中的Action列表
var actionList = m_Action.getInvocationList();

//委托中是否存在指定的Action
var isExit = Array.IndexOf(actionList,(Action)Func1);
var isExit = Array.IndexOf(actionList,(Action)Func2);


void Func1(){}

voi Func2(){}
相关推荐
淡海水10 小时前
02-06-原理篇-增量式GC与并发GC
算法·unity·c#·并发·gc·增量
Vertira11 小时前
C# 函数封装成 DLL,
开发语言·c#
浅尝辄止;12 小时前
设计模式在HIS/LIS医疗系统中的完整实践指南(C#版)
开发语言·设计模式·c#
kimloner1 天前
开源一个 376KB 的 Windows 桌面小工具:便签 + 截图标注 + OCR + 待办提醒(C# / WinForms)
windows·开源·c#·ocr·winforms
阿松爱学习1 天前
【Unity开发】Aspose.PDF的使用
unity·pdf·c#
半亩码田1 天前
C#转Python第4.8篇:正则表达式:Python re 模块 vs C# System.Text.RegularExpressions
python·正则表达式·c#
FPGA小徐1 天前
【一生一芯 / PA】异常响应机制:RISC-V 中 ecall → mtvec → mret 的完整代
开发语言·数据库·c#
淡海水1 天前
02-04-原理篇-GC Roots与对象图遍历
算法·unity·c#·图·gc·遍历·roots
胖纸不争1 天前
嫌桌面 Agent 太重,我“自己”写了一个
ai·c#·net core
当青春邂逅吉米多维奇1 天前
C#图解教程(第5版) 同步方法
开发语言·c#