当前位置:网站首页>C#委托的使用案例
C#委托的使用案例
2022-07-27 07:26:00 【济南医疗小程序状元】
C#委托的使用
using System;
namespace WeiTuo
{
class Program
{
// 带一个参数的委托 并且无返回值的委托
public delegate void SayUpdate(string name);
static void Main(string[] args)
{
// 委托的声明 委托的使用方法 委托的解释 将方法以变量的形式传递,并且以方法的形式执行。
//
SayUpdate dlg = SayHi;
dlg += SayBye;
dlg -= SayBye;
dlg("语音,你好啊");
// 匿名函数
Console.ReadLine();
}
public static void SayHi(string name)
{
Console.WriteLine($"{ name},你好啊 语音技术");
}
public static void SayBye(string name)
{
Console.WriteLine($"{ name},再见");
}
}
}
效果

边栏推荐
- flink去重(二)解决flink、flink-sql去重过程中的热点问题
- Help send a recruitment, base all over the country. If you are interested, you can come and have a look
- 【QT】capture. Obj:-1: error: lnk2019: unresolved external symbols__ imp_ Htons (solution)
- Oracle cleans up the Database disk space of tables with referenced partitions
- C language implementation of guessing numbers Games project practice (based on srand function, rand function, switch statement, while loop, if condition criterion, etc.)
- DEMO:PA30 银行国家码默认CN 增强
- 帮忙发一份招聘,base全国,有兴趣的可以过来看看
- [wsl2] configure the USB camera connecting the USB device and using the host
- The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly 100 times the improvement of analysis performance
- Apifox安装及使用
猜你喜欢

我是不是被代码给耽误了……不幸沦为一名程序员……

IDEA中文乱码怎么办

Bash: create a function that returns a Boolean value

C language implementation of guessing numbers Games project practice (based on srand function, rand function, switch statement, while loop, if condition criterion, etc.)

Gossip: talk with your daughter about why you should learn culture lessons well

MySQL backup strategy

What about idea Chinese garbled code

Plato Farm有望通过Elephant Swap,进一步向外拓展生态

opengl-shader学习笔记:varying变量

正则表达式基础整理
随机推荐
如何在电脑端登陆多个微信
ADC噪声全面分析 -02- ADC 噪声测量方法和相关参数
sql语句批量更新 时间减去1天
drawImage方法第一次调用不显示图片的解决方式
Apifox安装及使用
Flink de duplication (I) summary of common de duplication schemes in Flink and Flink SQL
Install tensorflow
Using soci to connect Oracle with PostgreSQL and SQLite on rhel8
Framework of electronic mass production project -- basic idea
Grayog log server single node deployment
Shell functions and arrays exercises
Regular and sed exercises
Solidity智能合约开发 — 3.3-solidity语法控制结构
Bingbing's learning notes: classes and objects (middle)
Shell enterprise interview exercise
Panabit SNMP配置
杂谈:手里有竿儿,肩上有网,至于背篓里有多少鱼真的重要吗?
flink1.14 sql基础语法(一) flink sql表查询详解
glGetUniformLocation,glUniform4f
帮个忙呗~不关注不登录,不到一分钟的一个问卷