#326 – Generic Type vs. Constructed Type
May 17, 2011 11 Comments
Once a generic type is provided with type arguments, it is known as a constructed type.
Here is the definition of a generic type:
// A generic type public class ThingContainer<TThing1, TThing2> { public TThing1 Thing1; public TThing2 Thing2; }
You declare instances of the generic type by providing arguments for its type parameters. The type name with the arguments is the constructed type.
// ThingContainer<Dog, DateTime> is a constructed type ThingContainer<Dog, DateTime> container = new ThingContainer<Dog, DateTime>(); container.Thing1 = new Dog("Bob"); container.Thing2 = DateTime.Now;
Pingback: #534 – What Good Are Generics? « 2,000 Things You Should Know About C#
Pingback: #1,027 – Type Parameters vs. Type Arguments in a Generic Class | 2,000 Things You Should Know About C#
Pingback: #1,039 – Deriving from a Generic Class | 2,000 Things You Should Know About C#
Pingback: #1,040 – Deriving from a Constructed Type | 2,000 Things You Should Know About C#
Pingback: #1,042 – Deriving from a Self-Referencing Constructed Type, Part I | 2,000 Things You Should Know About C#
Pingback: #1,043 – Deriving from a Self-Referencing Constructed Type, part II | 2,000 Things You Should Know About C#
Pingback: #1,044 – How Static Data Behaves in Generic Types | 2,000 Things You Should Know About C#
Pingback: #1,070 – A Generic Type Can Be Compiled | 2,000 Things You Should Know About C#
Pingback: #1,129 – Generic Dictionary Basics | 2,000 Things You Should Know About C#
Pingback: #1,134 – Use “of” Terminology for Generics | 2,000 Things You Should Know About C#
Pingback: #1,144 – Getting Type Information about a Generic Type | 2,000 Things You Should Know About C#