dotnetomaniak.pl - Artykuły z tagiem generics

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 1786 dni, 7 godzin, 5 minut 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 1792 dni, 6 godzin, 57 minut temu AGirlAmongGeeks 122 źrodło rozwiń

A few days ago, a friend o mine had a very interesting issue with C# code he had written...

Źródło: foreverframe.net
Dziel się z innymi:
Method invocation in C# is tricky - Forever F[r]ame

Sztuka programowania 2224 dni, 4 godziny, 14 minut temu dpawlukiewicz 221 źrodło rozwiń

It’s pretty funny to me when you think that you know some programming language quite well and suddenly you find out some feature, you’ve never heard before. I mean at all. That’s exactly what happened to me yesterday. Let’s see what’s that. Generics are very useful in programming since we can avoid writing similar code multiple times. But when we start to complicate them too much, it quickly reduces the legibility of the code. Of course, I don’t claim that whe...

Tagi: alias, C#, generics
Źródło: foreverframe.net
Dziel się z innymi:
CodeTip #7 - Aliased generics in C# - Forever F[r]ame

Sztuka programowania 2491 dni, 8 godzin, 4 minuty temu dpawlukiewicz 208 źrodło rozwiń

dspannonymous methods, annonymous types, extension methods, generics, LambdaExpressions, LINQ, object initializer, varkubaGdzie są te fjuczery? Tyle postów pisałem tylko o rzeczach, na których LINQ został zbudowany. Ale gdzie one są? Tyle dodatków do języka dla jednego prostego zapytania?

Ten w którym LINQ bierze wszystko - jakubmaguza.pl

Daj się poznać 2017 2532 dni, 16 godzin, 21 minut temu Jakub Maguza 93 źrodło rozwiń

I've seen many posts about generics in C# lately. And while they cover basics pretty well, most of them doesn't contain information about constraints which are things that causing generics to be really fun.

Tagi: generic, generics
Źródło: hryniewski.net
Dziel się z innymi:
Working with generics and constraints in C# – Hryniewski.NET

Daj się poznać 2017 2598 dni, 3 godziny, 32 minuty temu Rafał Hryniewski 114 źrodło rozwiń

Pingwiny no i typy generyczne! Czym są typy generyczne? Jakie mamy korzyści z korzystania z typów generycznych?

Tagi: C#, generics
Dziel się z innymi:
Typy generyczne – Dev on board

Sztuka programowania 2600 dni, 17 godzin, 18 minut temu devonboard 83 źrodło rozwiń

A więc zaczynamy przygodę z LINQ! Na pierwszy ogień biorę ‘generyczność’ czy ‘generics’ jak kto woli. Wspaniały, cudowny, dodaj swoje fjuczer, który zostal wprowadzony wraz z C# 2 i .NET 2.0.  Dlaczego na pierwszy ogień? Bo według mnie to najważniejsza rzecz wprowadzona w tamtych czasach. Zapewne niewielu czytających pamięta czasy sprzed kolekcji generycznych. Śpieszę z przypomnieniem.

Tagi: DSP, generics
Źródło: jakubmaguza.pl
Dziel się z innymi:
Ten o generyczności - jakubmaguza.pl

Daj się poznać 2017 2596 dni, 5 godzin, 41 minut temu Jakub Maguza 53 ź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 2686 dni, 18 godzin, 54 minuty temu dpawlukiewicz 187 źrodło rozwiń

I would like this blog post to serve as a quick reference that recalls the basic concept of covariant and contravariant type parameters of generic interfaces in the C# language.I tried to keep the example as simple as possible. Included comments explain the key points. No long stories and no dissertations.

Tagi: C#, generics
Źródło: blog.pjsen.eu
Dziel się z innymi:
[EN] Interface type parameter covariance and contravariance in C# | PJSen Blog

Sztuka programowania 3947 dni, 6 godzin, 30 minut temu pjsen 62 źrodło rozwiń

Najaktywniejsi w tym miesiącu