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

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.

One Response to #326 – Generic Type vs. Constructed Type

  1. Pingback: #534 – What Good Are Generics? « 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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers