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

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 数迹

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为事件传递的参数