Enums, Flags, and Bitwise operations [C# / DotNet]

  Рет қаралды 2,866

Data Vids

Data Vids

Күн бұрын

Enums, flags, and bitwise operations in DotNet with examples using C#. In this video we explain how to setup an enumeration for binary operations (examples include bitwise OR, and bitwise SHIFT), and explain general usage. Not to be confused with IEnumerable!

Пікірлер: 4
@DataVids
@DataVids 3 жыл бұрын
Must-have additional info from Coda17 on Reddit: If you are using an enumeration as flags you should add the `[Flags]` attribute to the class. Additionally, enums don't have to be integers, there are several other types you can use to store the enum (although, you usually need a special reason to use a different type). Bonus tip: I like to number my flags using bit-shift operator so it's very evident exactly where the numbers are coming from rather than relying on remembering base 2. flagA = 1
@PIMARINE
@PIMARINE 3 жыл бұрын
Man, I was just thinking about You.. Mssing my DataVids.
@lav4eee
@lav4eee 2 жыл бұрын
Hello sir, can you say a real-world example when flags enums are used in web development? Greetings.
@DataVids
@DataVids 2 жыл бұрын
Hi @lav4eee, in web development this is be used frequently in backend, database services, etc. Flags re used anywhere that a true/false is needed, IE 'isAuthenticated', 'isGreen', etc.. but the Bitwise operations would be basically anywhere that combinations of true/false values could represent something of value. I think most real world examples of the bitwise operations are related to hardware and low-level programming, but it definitely can be used in web programming as well depending on your requirements for your app. One thought is a easy/quick way to hash data (using the XOR operator ^), or when manipulating images prior to sending them back to the frontend for example.
Entity Framework Code First (2021, DotNet Core or DotNet 5)
27:36
C# Flags Enum Explained - Deep Dive
26:40
Shiv Kumar
Рет қаралды 14 М.
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 29 МЛН
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 45 МЛН
Move appSettings.json values to User Secrets
19:03
Data Vids
Рет қаралды 1,6 М.
Bitwise Operator in C# (Urdu/Hindi)
6:26
Fahad Hussain
Рет қаралды 2,9 М.
Bitwise Operations & Bit Masking
13:08
Learn Learn Scratch Tutorials
Рет қаралды 33 М.
Windows EventLogs in DotNet (easy logging setup)
12:49
Data Vids
Рет қаралды 1,9 М.
Klavye İle Trafik Işığını Yönetmek #shorts
0:18
Osman Kabadayı
Рет қаралды 4,1 МЛН
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 2,7 МЛН
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 382 М.
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 1,9 МЛН
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 656 М.
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 7 МЛН