Good introduction to generics

Being driven by benefits, I am looking for a way to integrate general programming into my current programming style. I would like to use generics in C #, but cannot find a good introductory material with some everyday use cases. If you have experience working with generics: what resources do you find most useful for studying them? (books, articles, etc.)

+4
source share
4 answers

O'reilly Generic Article

And I really liked the generic part of the book C # in the book "Depth" by John Skeet, although it is not innate, but more ... in depth (as in the read, when you are comfortable with generics to learn a lot of interesting things about them, but not how introduction).

+5
source

Honestly, I found that just using the System.Collections.Generic classes is the best starting point. If you have not already done so, switch from using the System.Collections classes to the new generic options. This will help you get used to the concepts. A strongly typed dictionary is a wonderful thing.

After this, there is not too much conceptual leap to create your own common class. Intellisense is a great guide. Just start writing:

class Something<T> { T Item { get; set; } } 

And note that your second โ€œTโ€ appears in intellisense. Visual Studio cheers you up! Hey it's easy!

In the end, you will exhaust the obvious, and then you will need the best resource. Google and MSDN were all I need today, but by the time you go beyond that and want a deeper understanding, you already know enough to find the best books for your level of understanding.

Good luck

+3
source

If you intend to use C # and .NET, I would recommend that you go over the white papers , specifically the Introduction to the Generics Programming Guide .

These guides should be level zero for you if you already know C # but just want to deal with generics. Numerous daily code examples are also provided.

+1
source

I wrote 2 short articles on generics (mostly targeted to the List class)

http://dotnetchris.wordpress.com/?s=generics

0
source

All Articles