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(){}
相关推荐
JQLvopkk33 分钟前
能用C#开发AI
开发语言·人工智能·c#
游乐码8 小时前
c#类和对象
开发语言·c#
沃码12 小时前
【Lively Wallpaper 】插件开发:LivelyProperties.json 全流程实战教程
c#·json·livelywallpaper·视频壁纸
github.com/starRTC17 小时前
Claude Code中英文系列教程34:再谈Skills
开发语言·c#·ai编程
bugcome_com19 小时前
C# 判断语句详解(if、switch、三目运算符、Null 条件运算符)
c#
霸王•吕布21 小时前
C#-使用OpenTK渲染3D模型
c#·opentk·glcontrol
游乐码1 天前
c#封装成员变量和成员方法和访问修饰符
开发语言·c#
Never_Satisfied1 天前
在c#中,Jint的AsString()和ToString()的区别
服务器·开发语言·c#
Never_Satisfied1 天前
在c#中,获取文件的大小
java·开发语言·c#
weixin_468466851 天前
PyTorch导出ONNX格式分割模型及在C#中调用预测
人工智能·pytorch·深度学习·c#·跨平台·onnx·语义分割