当前位置:网站首页>Issues related to C # delegation and events
Issues related to C # delegation and events
2022-06-13 07:04:00 【Light of ten thousand years】
1. The essence of entrustment
Everyone should know that the function is called to find the first address of the function , Then call , The essence of a delegate is to record the first address of a function , Just like the essence of calling a function .
2. The initialization of delegates is different from that of custom types
1. entrust
Delegates can be assigned to NULL Under the circumstances , To assign the function name , It can be called normally , Unwanted new.
2. Custom type ( Reference type )
must do new To assign a value to a member element , Why? ? for example :
class Test
{
public int a;
}
Test s=null;
s.a=100;
Console.WriteLine(s.a);
Will report an error directly , Because it is not initialized , No memory space has been requested for the change variable , Only variable names have content space .
reason : Delegation can be dispensed with new The reason is that the variable name can be directly assigned to the first address of the function , You can go directly to .
event
1. Events can only be defined within a class , Intra class call , Because its real writing is private , Cannot call directly
边栏推荐
- Common method of props changing value V-model sync
- Project analysis of Taishan crowdfunding mode: why is Taishan crowdfunding mode so popular?
- DM Experiment 6: filter replication
- Byte (nine)
- 16、 IO stream (II)
- Differences between SQL and NoSQL of mongodb series
- 考研英语
- Vsys of Isis (virtual system)
- What does my financial product mean in clearing?
- 1154. day of the year
猜你喜欢

如何使用望友DFM軟件進行冷板分析

【ViveFocus使用WaveVR插件获取手柄操作事件】

Network planning common interview knowledge (I)

FSM state machine

Reflection of C # Foundation

Why is the blind box e-commerce mode so popular?

Why is the new e-commerce outlet mode so popular? What is the specific mode?

105. constructing binary trees from preorder and inorder traversal sequences

RT thread simulator lvgl control: switch switch button control

2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
随机推荐
不间断管理设计
[Tencent Alibaba's most comprehensive collection of test questions] (four sides: three rounds of technology +1 round of HR)
ML之FE:Vintage曲线/Vintage分析的简介、计算逻辑、案例应用之详细攻略
【腾讯阿里最全面试题集锦】(四面:3轮技术+1轮HR)
How to use Wangyou DFM software for cold plate analysis
Detailed description of drawing ridge plot, overlapping densities of overlapping kernel density estimation curve, facetgrid object and function sns Kdeplot, function facetgrid map
Fe of mL: introduction to vintage curve /vintage analysis, calculation logic and detailed introduction to case application
Monotone stack top31 of interview must brush algorithm top101
Xuanwu cloud technology passed the listing hearing: the performance fluctuated significantly, and chenyonghui and other three were the controlling shareholders
基于ESP32CAM实现WebSocket服务器实时点灯
JS case Xiaomi second kill countdown New Year Countdown
10 Honest Facts I Want To Share With All Junior Developers
Tidb execution plan -- II
Lightning breakpoint continuation
Try to use renderdoc to view the shader code of UE
Eureka server multi node deployment
How to make a development board from scratch? Illustrated and illustrated, step by step operation for you to see.
如何使用望友DFM軟件進行冷板分析
Will the chain 2+1 model be a new business outlet and a popular Internet e-commerce market?
我的理财产品显示清算中是什么意思?