How Sharp is Your C#? | Riddle #2

preview_player
Показать описание
In today's video, we'll break down a short riddle that almost everyone guessing the correct answer out of 4 possible answers got wrong.

This riddle is all about the implicit operator in C#. Hope you enjoy it!

Connect with me on 'em socials:
Рекомендации по теме
Комментарии
Автор

That was a great riddle. It shows what possible dangers can come from implicit operators if you don’t pay attention.

apfohl
Автор

Great one! More riddles, please 😃
Good devs should be able to run short snippets of code in 🧠

rustamhajiyev
Автор

19 x 3 +1 I didn't know all this ! Excellent Amichai as always !! As improvement, i think it would have been interesting to see the percentage for each of the answer :)

LinkingWorlds
Автор

Great, short video. Sadly, I got it wrong. Also a great show case of why we should be explicit in our code. Please don't write code like this! 😂

Coburah
Автор

implicit methods/operators are great until they’re abused recklessly and you have to debug them

thatojadezweni
Автор

I got right at very first time and now answer is 58.

pirati
Автор

didn't know about the "automatic" conversion of value in a Foo object!

marcovalenti
Автор

gotta be 58 since nothing really changed after you just explained what tricked many of us and just repeats that nasty operation x)

raptorcheesus
Автор

i thought i got it right until you said 19 and realized i didnt see the operator returns a Foo again haha

fkeyzuwu
Автор

(19 * (2+1)) + 1 = 58 would be my solution

CoderboyPB
Автор

Answer: 58

Create Foo = 5
Implicit invoked: 5 + 1 = 6

Compute Foo *=2
Create Foo, rhs Implicit: 2 + 1 = 3
Use previous Foo, lhs: 6
Compute Operation: 6 * 3 = 18
Create Foo return implicit: 18 + 1 = 19

Compute Foo *=2
Create Foo, rhs Implicit: 2 + 1 = 3
Use previous Foo, lhs: 19
Compute Operation: 19 * 3 = 57
Create Foo return implicit: 57+ 1 = 58

AndrewKamensky
Автор

I knew you can should to your leg by using implisit operator but this is like way beyond common sense

nage
visit shbcf.ru