Тёмный

Covariance and Contravariance Clearly Explained in C# - A Deeper Look 

Full Stack Amigo
Подписаться 1,5 тыс.
Просмотров 16 тыс.
50% 1

Covariance and Contravariance can be understood easier if you learn it by practical examples despite their complexity in the first look. In this video, we'll finally understand Covariance and Contravariance in C# and then we will expand our knowledge with inspecting them in the world of Generics!
So we'll learn about generic types and C# "in" keyword and C# out keyword in the context of variance.
What is Covariance in C#?
What is ContraVariance in C#?
👉 Jump forward
🔗 Intro: 0:00
🔗 Func and Action 0:42
🔗 Defining our types: 1:39
🔗 Covariant: 3:02
🔗 Contravariant: 4:37
🔗 Covariant Generic Type Parameter: 6:59
🔗 Contravariant Generic Type Parameter: 9:36
🔗 Covariance Generics in .NET: 11:34
🔗 Real-World Example: 12:18
-----
I've used .NET Core 3.1 and C# 8.0 in this video.
😀If you have any question ask me in the comments
🔴 SUBSCRIBE 🔥 using the following link
bit.ly/39PJJ8Z
Follow Me On Social Medias ⬇
Instagram: / fullstackamigo ✅
Twitter: / fullstackamigo✅
Telegram: www.t.me/fullstackamigo ✅
Website: fullstackamigo.com ✅
Music Credit: Bensound.com
#covariance #contravaiance #csharp

Опубликовано:

 

3 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 48   
@FullStackAmigo
@FullStackAmigo 4 года назад
What do you think of Covariance and Contravariance? Tell me!
@swapniltayade
@swapniltayade 8 дней назад
Well explained, last example depicting real world use of contravarient was good.
@FullStackAmigo
@FullStackAmigo 7 дней назад
Glad it was helpful, thanks!
@peternguyen9382
@peternguyen9382 3 месяца назад
subscribed! simple and easy to understand the concept of variance
@FullStackAmigo
@FullStackAmigo 3 месяца назад
Welcome aboard!
@p3t3mit
@p3t3mit 4 года назад
I've watched like 3 videos on this subject before getting here, and you actually made it click for me. Thank you!
@FullStackAmigo
@FullStackAmigo 4 года назад
I'm realy glad to hear this. Thanks for the support.
@pareshdehadray7414
@pareshdehadray7414 2 года назад
Clear explanation. First time I understood Covariance and Contravariance perfectly.
@FullStackAmigo
@FullStackAmigo 2 года назад
Thank you. Glad to hear it!
@HosseinFotowatKhah
@HosseinFotowatKhah 4 года назад
It was really understandable and accurate.
@jamasbsamiakalantari9979
@jamasbsamiakalantari9979 3 года назад
Perfect, Perfect, Perfect, No better explanation could exist , at first it seemed boring for few seconds but that disappeared quickly
@FullStackAmigo
@FullStackAmigo 3 года назад
Thanks, Thanks and Thank you again! I'm really glad that you liked it.
@KamilKubiak96
@KamilKubiak96 2 года назад
Really well explained. Thank you!
@FullStackAmigo
@FullStackAmigo 2 года назад
Glad it was helpful!
@mccarthyjonathan69
@mccarthyjonathan69 3 года назад
Your amazing dude. Thank you I learnt so much from this video
@FullStackAmigo
@FullStackAmigo 3 года назад
😍🌹 Thanks you so much! Glad you enjoyed it!
@muhamedkarajic
@muhamedkarajic 2 года назад
I remember this youtube channel from back when I did C++ as a student. Good old days with the Amigo!
@FullStackAmigo
@FullStackAmigo 2 года назад
Welcome back!
@ashishkalra9438
@ashishkalra9438 3 года назад
Very nicely explained......Thank u so much
@FullStackAmigo
@FullStackAmigo 3 года назад
So nice of you
@abhilashbhaisare4429
@abhilashbhaisare4429 3 года назад
Great. Thank you
@FullStackAmigo
@FullStackAmigo 3 года назад
Glad you liked it!
@a-s733
@a-s733 3 года назад
Great ,Thank you amigos
@FullStackAmigo
@FullStackAmigo 3 года назад
Thank you too
@anupampatel6890
@anupampatel6890 3 года назад
Very nice explanation. Thanks
@FullStackAmigo
@FullStackAmigo 3 года назад
Glad it was helpful!
@angelmunoz6332
@angelmunoz6332 2 года назад
Muchas gracias amigo
@FullStackAmigo
@FullStackAmigo 2 года назад
Thanks!
@robertmrobo8954
@robertmrobo8954 4 года назад
First time watching this, I don't understand... I will watch the video over and over again till I do.
@FullStackAmigo
@FullStackAmigo 4 года назад
Don't worry, take your time, this was not easy for me too. Try do it yourself.
@wennwenn1422
@wennwenn1422 Год назад
how does comparer example at the end teach/support co/contravariance topic?
@FullStackAmigo
@FullStackAmigo Год назад
Hi! In the last example we are creating a SortedSet. SortedSet accepts an implementation of IComparer. Normally we would use an IComparer for a SortedSet, right?! But here in our example, we are using an IComparer instead! And since Vehicle is a less derived typed compared to Car, this means we are using a less derived type (IComparer) instead of IComparer that was needed! And this is called contravariance! If you look at the video again in 9:36 we are doing the exact same thing!
@wennwenn1422
@wennwenn1422 Год назад
@@FullStackAmigo thanka Amigo, that makes sense.
@krishramakrishna9567
@krishramakrishna9567 2 месяца назад
Where we can downloaded ad this code what type of apps will use covariance and çontra variance
@FullStackAmigo
@FullStackAmigo Месяц назад
Well, this is not something that you usually need to work with unless you really need it! It can be used for developing libraries. Unfortunately, I didn't keep the code, but I usually upload codes to telegram channel (@fullstackamigo) or GitHub (@fullstackamigo)
@DoomCatcher
@DoomCatcher 2 года назад
I found this very difficult to follow, please in the future break down what each part of what you're doing means at the end of it I still didn't even understand what a covariance or contravariance is never mind the more advanced generic interface examples you went onto demonstrating...
@FullStackAmigo
@FullStackAmigo 2 года назад
Maybe I'll do another video on this but it's generally the most difficult concept in C# (in my opinion) so don't worry if you didn't get it on first try. Unfortunately I tried to shorten the length of the video so this made me to do some complex things at the end of the video! Try implementing the first part on your own, and you'll understand the concept easier.
@DoomCatcher
@DoomCatcher 2 года назад
@@FullStackAmigo if you redo it I'll be interested to see it
@stamatiszamanis4784
@stamatiszamanis4784 3 года назад
Please fix the audio. My woofer is vibrating like a Turbo GT car. What I mean is, Hello your microphone has a lot of low frequency noise(~50Hz) making the bass very distracting.
@FullStackAmigo
@FullStackAmigo 3 года назад
Thanks for the comment, I'm trying many ways from different mics to the different software, I think I need a standard mic but I can't afford one right now. But I'll try more, sorry for inconvenience.
@hoseinabdl3263
@hoseinabdl3263 3 года назад
better called full stack haji
@DotnetistEnterprise
@DotnetistEnterprise 2 года назад
I cant concentraint because of the background sound
@FullStackAmigo
@FullStackAmigo 2 года назад
Sorry, This issue no longer exists in the recent videos! Thanks for feedback!
@EminoMeneko
@EminoMeneko 3 года назад
Seriously music is distracting and making it difficult to understand what you say.
@FullStackAmigo
@FullStackAmigo 3 года назад
Sorry for that, I'll try to improve next time. Thanks for the comment.
@amirhosseinahmadi3706
@amirhosseinahmadi3706 2 года назад
داداش ایرانی نیستی احیانا؟
@FullStackAmigo
@FullStackAmigo 2 года назад
سلام, آره هستم
@amirhosseinahmadi3706
@amirhosseinahmadi3706 2 года назад
@@FullStackAmigo آها حله، موفق باشی داداش 😍😀
Далее
Covariance and Contravariance
13:31
Просмотров 11 тыс.
C# Covariance
17:27
Просмотров 7 тыс.
Covariance Revisited
18:18
Просмотров 1,1 тыс.
Don't throw exceptions in C#. Do this instead
18:13
Просмотров 251 тыс.