What Will Be the Output of This Code?

  Рет қаралды 9,350

Milan Jovanović

Milan Jovanović

14 күн бұрын

Пікірлер: 43
@TDenis-youtube
@TDenis-youtube 12 күн бұрын
Output: the developer who wrote this code will be fired
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
Maybe in your company 🔥
@paulolopes7818
@paulolopes7818 9 күн бұрын
😂😂
@s1kky
@s1kky 13 күн бұрын
the `+=` operator is used to combine the delegates so the output will be Check out MMA Check out PCA Stay awesome!
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@idklxzeprobably
@idklxzeprobably 10 күн бұрын
​@@MilanJovanovicTechI thought their adresses in memory would add up together
@clouds187
@clouds187 13 күн бұрын
All 3 would be printed im pretty sure :)
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@iyerpram
@iyerpram 12 күн бұрын
All 3 would be printed as it is a delegate
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@markdibeh
@markdibeh 6 күн бұрын
I think it gonna return a List> . It should print the three console. But I am not sure abt the return type
@MilanJovanovicTech
@MilanJovanovicTech 5 күн бұрын
Prints it all out
@GekoPoiss
@GekoPoiss 12 күн бұрын
in FP terms, it's the equivalent of combining instances of IO monads with the sequencing operator (>>) - e.g. `putStrLn "Hi 1" >> putStrLn "Hi 2"`
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
Cool 👌
@MAHDIHESARI
@MAHDIHESARI 12 күн бұрын
Check out MMA Check out PCA Stay awesome!
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@devjonie
@devjonie 8 күн бұрын
All the assigned functions will run
@MilanJovanovicTech
@MilanJovanovicTech 8 күн бұрын
@mazingguitar
@mazingguitar 2 күн бұрын
Still it's sorta funny as when you check for type it's System.Action. What happens under the hood?
@MilanJovanovicTech
@MilanJovanovicTech 2 күн бұрын
Magic: learn.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/how-to-combine-delegates-multicast-delegates
@MrJoakin100
@MrJoakin100 8 күн бұрын
I’m sure that it print the three sentences
@MilanJovanovicTech
@MilanJovanovicTech 8 күн бұрын
@mrwalkan
@mrwalkan 12 күн бұрын
Multicast delegate
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@vallJune
@vallJune 10 күн бұрын
Combine delegate in multicast delegate base class
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
@vitek0585
@vitek0585 9 күн бұрын
Here is Action delegate. Thus three writeline methods are called
@MilanJovanovicTech
@MilanJovanovicTech 9 күн бұрын
@yiliang9702
@yiliang9702 12 күн бұрын
delegate supports +=opetator. all of the funtions will be triggered.
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@rusektor
@rusektor 13 күн бұрын
All 3 will be run thanks to broadcasting 😊
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@rusektor
@rusektor 12 күн бұрын
@@MilanJovanovicTech It's also interesting: when I write the following code, Visual Studio squiggled last line with warning "Dereference of a possibly null reference": Action del1 = () => Console.WriteLine("Task 1"); Action del2 = () => Console.WriteLine("Task 2"); Action del3 = () => Console.WriteLine("Task 3"); var func = del1; func += del2; func += del3; func(); Console.WriteLine("remove del2..."); func -= del2; func(); I then realized that this is due to the fact that there can be a situation when there will be no delegates to run. The solution is simple: func?.Invoke(); 😉
@sameerband2933
@sameerband2933 12 күн бұрын
All three methods would be executed. We have event to enforce multicast delegate so that we don't accidently assign a delegate instead of subscribing. I. E. Enforce += and prevent =
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@dinorme
@dinorme 12 күн бұрын
easy, its a delegate so it will print 3 of them :3
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
@mohammadkalbouneh7892
@mohammadkalbouneh7892 12 күн бұрын
All three right?
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
Yes
@onaspnet
@onaspnet 10 күн бұрын
Multicast delegates
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
@codingwithgyver1637
@codingwithgyver1637 12 күн бұрын
seems just what a delegates do for append actions
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
Indeed
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 463 М.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 95 М.
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 151 МЛН
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 58 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 43 МЛН
Concurrency Vs Parallelism!
4:13
ByteByteGo
Рет қаралды 59 М.
Get Rid of Exceptions in Your Code With the Result Pattern
13:06
Milan Jovanović
Рет қаралды 45 М.
Modular Monoliths Are The New Microservices
31:08
TaleLearnCode
Рет қаралды 23 М.
How I would learn to code (if I could start over)
10:52
PIRATE KING
Рет қаралды 1,3 МЛН
NVIDIA’s Crazy New AI Paints With Images!
5:21
Two Minute Papers
Рет қаралды 49 М.
The CrowdStrike Problem Isn’t A Simple Fix…
13:04
Theo - t3․gg
Рет қаралды 67 М.
SQLite's WAL mode is fast fast
9:25
Aaron Francis
Рет қаралды 10 М.
The Easiest Way To Manage Database Migrations in .NET
11:40
Nick Chapsas
Рет қаралды 33 М.
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 328 М.
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 14 МЛН
Cheapest gaming phone? 🤭 #miniphone #smartphone #iphone #fy
0:19
Pockify™
Рет қаралды 3,8 МЛН
Что не так с раскладушками? #samsung #fold
0:42
Не шарю!
Рет қаралды 177 М.