惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Security Latest
Security Latest
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AI
AI
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
S
Secure Thoughts
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
V
V2EX
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tenable Blog
T
Threat Research - Cisco Blogs
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
Lohrmann on Cybersecurity
F
Full Disclosure
H
Help Net Security
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
O
OpenAI News
S
Securelist

博客园 - 数迹

1.winform中App.config配置mssql连接字符串 where关键字 1.params 关键字 1.创建实体类UserInfo 1. UserInfo表的创建 3.SqlCommand组件 2.在DbHelper.cs 中使用连接字符串 多播委托 委托总结:委托提供了 A类的对象 调用 B类对象的同一类方法 的能力。 委托3--委托声明比较 委托2 文心快码 委托1 sql提示注册表中无 \100\ConfigurationState的解决方法 - 数迹 - 博客园 安装SQL server 提示重新启动计算机失败怎么解决 DataGridView插入指定类型的列 菜单制作过程笔记1 ${pagecontext.request.contextpath}绝对路径理解 eclipse中修改JSP模板中的默认编码 hibernate的ddl-auto属性
事件委托1
数迹 · 2026-02-12 · via 博客园 - 数迹

image

image

image

image

image

image

image

image

image

image

image

image

===================================================================================================================

委托是 同类型方法抽象出的类 的一个或者多个对象,那么这个委托其实就是个方法

这样之后直接声明一个事件委托指针

在本类的事件触发(就是执行其中一个方法)时,一个委托(实际参数)被调用

被委托指向的另一个类的方法定义时使用的是形式参数

委托就是A类定义的一个方法,交付给B类触发了某个事件的方法去运行。

Class A{        形式参数

       methordA(Object sender,EventArgs args)

}

Class B{

       Public event 委托类名 委托;

methordB{

       if(委托!=null

       {

              委托(实际参数)

}

} 

}

Main(){

       A a = new A();

B b= new B();

//a的方法,添加到b的委托中

b.委托+=a.方法名;

//执行class B methordB方法启动委托方法。

b.methordB();

}

整个过程定义过一次形式参数,另一个类中使用该方法时用到实际参数,其他没有再涉及到参数,都使用的委托名和方法名。

Object sender为事件发出者 ,EventArgs args为事件传递的参数