Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all of the generic collections/types in the 4.0 .NET Framework?

Is there an exhaustive list of all of the "base" (not used in an object-oriented sense but more in a common sense) generic types in the 4.0 .NET Framework? I have found this list that I often send newer/mid-level devs to so they can understand how non-generic types map to generic types, but this is by no means exhaustive. I'm looking for something that also includes things such as KeyValuePair<>, Tuple<>, and other basic generics that may not be very-well known. Interfaces such as IObservable<> would be nice but not necessarily required.

like image 293
Jaxidian Avatar asked Dec 01 '25 08:12

Jaxidian


2 Answers

Here's a powershell fragment to list all the generic types in the system assemblies

[AppDomain]::CurrentDomain.GetAssemblies() | 
    ? { $_.FullName -match "^System" -or $_.FullName -match "mscorlib"} |  
        % { $_.GetTypes() | ? { $_.ContainsGenericParameters } }

This could be adapted to give a more comprehensive list. If you load powershell w/ a .Net 4 config, you'll get the 4.0 list.

Count Name                      
----- ----                      
    1 System.Xml
   12 System.Data
   67 System
  187 mscorlib
  325 System.Core
like image 174
Scott Weinstein Avatar answered Dec 03 '25 22:12

Scott Weinstein


In Visual Studio open the object explorer, choose .NET 4 Framework, search for IEnumerable<T> and expand the list of derived types. It's way too much to paste here :-).

alt text

like image 21
VVS Avatar answered Dec 03 '25 23:12

VVS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!