#326 – Generic Type vs. Constructed Type

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;
Advertisements

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

11 Responses to #326 – Generic Type vs. Constructed Type

  1. Pingback: #534 – What Good Are Generics? « 2,000 Things You Should Know About C#

  2. Pingback: #1,027 – Type Parameters vs. Type Arguments in a Generic Class | 2,000 Things You Should Know About C#

  3. Pingback: #1,039 – Deriving from a Generic Class | 2,000 Things You Should Know About C#

  4. Pingback: #1,040 – Deriving from a Constructed Type | 2,000 Things You Should Know About C#

  5. Pingback: #1,042 – Deriving from a Self-Referencing Constructed Type, Part I | 2,000 Things You Should Know About C#

  6. Pingback: #1,043 – Deriving from a Self-Referencing Constructed Type, part II | 2,000 Things You Should Know About C#

  7. Pingback: #1,044 – How Static Data Behaves in Generic Types | 2,000 Things You Should Know About C#

  8. Pingback: #1,070 – A Generic Type Can Be Compiled | 2,000 Things You Should Know About C#

  9. Pingback: #1,129 – Generic Dictionary Basics | 2,000 Things You Should Know About C#

  10. Pingback: #1,134 – Use “of” Terminology for Generics | 2,000 Things You Should Know About C#

  11. Pingback: #1,144 – Getting Type Information about a Generic Type | 2,000 Things You Should Know About C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: