dotnetomaniak.pl - Artykuły z tagiem Covariance

Today I will write about the way variance influences type checking in C#. Yes, the fact that one type can be passed to a generic method that requires another type, depends on these 2 small keywords we write before ‘T’ (or whatever 😉) in interface header.

Cannot implicitly convert type ‘Abc’ to ‘IAbc’ – Contravariance vs Covariance – part 2. – A Girl Among Geeks

Sztuka programowania 1780 dni, 17 godzin, 24 minuty temu AGirlAmongGeeks 96 źrodło rozwiń

Have you ever seen these mysterious ‘in’ and ‘out’ keywords in generic interfaces’ definitions? If so, you’ve probably already checked what it means, but if not… You better read this and the next post. So today we will talk about the basics of variance in our own generic interfaces.

<in T> vs <out T> - Contravariance vs Covariance – (the easier) part 1. – A Girl Among Geeks

Sztuka programowania 1786 dni, 17 godzin, 15 minut temu AGirlAmongGeeks 122 źrodło rozwiń

Sometimes it happens that we use mechanisms/features of specific language without beeing aware of it. That’s fine, but if you’ll want to discuss your code in a future to the audience or coworkers, soon or later you’ll be forced to learn it and understand (or at least name it using technical nomenclature). Therefore, today I’m going to discuss two related „mechanisms” of C# which are covariance and contravariance.  Covariance Covariance is a type conversion from the specific type to the more general (ba...

Źródło: foreverframe.pl
Dziel się z innymi:
What are covariance and contravariance in C#? - Forever F[r]ame

Sztuka programowania 2681 dni, 5 godzin, 12 minut temu dpawlukiewicz 187 źrodło rozwiń

Niedługo dostępny będzie C# 4.0. Z ciekawych rzeczy, które mają wprowadzić:dynamic - ciekawy, aczkolwiek niepokojący feature. W skrócie - dostaniemy typy nieokreślone z możliwością wywoływania na nich dowolnych metod, które będą bindowane dopiero w czasie wykonywania (w przypadku klas .NET-owych; dla obiektów COM i obiektów z interfejsem IDynamicObject magia jest jeszcze głębsza)...

dabroz.scythe.pl » Nowości w C# 4.0

Inne 5464 dni, 8 godzin, 16 minut temu macko 302 źrodło rozwiń

Najaktywniejsi w tym miesiącu