Coding Shorts: Demystifying Bitwise Operators in C#

preview_player
Показать описание
In this video, I try and explain how binary and bitwise operators can work together with enumerations in C#.

If you like this video, you might like other videos in my Instructional Videos:

Рекомендации по теме
Комментарии
Автор

Brakes are a feature? I thought they were essential 😂
Thanks for the video! Still struggling to completely wrap my head around this, but I feel I understand it more than I did before I watched this :)

tommo
Автор

Thank you so much Shawn!
That Write utility helped me to understand the leetcode bit manipulation questions.

And that Flags part is awesome!
Or to collect, And to check.

Again, it all goes back to the Write utility function.

Ty again and keep up the good work!

kinglygaurav
Автор

FYI: 0b0100 is 4 not 8. The video is great

sampannapokhrel
Автор

Very nice video. When not dealing with these topics for a while, there's nothing like a good refresher to get you back on track. Thanks.

marklord
Автор

A very nice video. I would personally set the [Flags] enum values in binary, which makes it very visual that each enum value has only one bit set to '1'.

imaginative-monkey
Автор

Yes very helpful. XOR ^ was something that I never really learned. Adding in binary very cool. The binary | were you add multiple enums or options to one config type variable is useful. I think the only time I've used it was for global decimal styles number formatting, etc.

ChrisG
Автор

I don't get why the [Flags] attribute can't tell the compiler to properly binary space the values of the enum. If it doesnt work when you don't do it precicely, why not just automate it.

ChrisUG
Автор

Wouldn't feature.HasFlag(Brakes) be better for such a situation? It's more readable and it's type-safe.

kubastanek
Автор

I did some leetcode exercises and there is always one brilliant guy using them and it frustrates me because I dont know when to use them, like problem doesnt tell me ok this can be done bitwise operators because the examples I watched are simplistic and trivial

MrZnSstr
Автор

How to use csi with VS Code... I see message - 'csi' is not recognized as an internal or external command

alakhkaushik