Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 592569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:45:12+00:00 2026-05-13T15:45:12+00:00

I was going through Asp.Net MVC lesson and learned that, for a method to

  • 0

I was going through Asp.Net MVC lesson and learned that, for a method to qualify as an action for a controller,

  • It must not have an “open generic type”

I understand generics somewhat and use them to some extent, but:

  • What is an open generic type in .Net.
  • Is there such a thing as a closed generic type?
  • Open generic type is a term not used very often. What is used / confused with it ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:45:12+00:00Added an answer on May 13, 2026 at 3:45 pm

    The C# language defines an open type to be a type that’s either a type argument or a generic type defined with unknown type arguments:

    All types can be classified as either open types or closed types. An open type is a type that involves type parameters. More specifically:

    • A type parameter defines an open type.
    • An array type is an open type if and only if its element type is an open type.
    • A constructed type is an open type if and only if one or more of its type arguments is an open type. A constructed nested type is an open type if and only if one or more of its type arguments or the type arguments of its containing type(s) is an open type.

    A closed type is a type that is not an open type.

    Therefore T, List<T>, and Dictionary<string,T>, and Dictionary<T,U> are all open types (T and U are type arguments) whereas List<int> and Dictionary<string,int> are closed types.

    There’s a related concept: An unbound generic type is a generic type with unspecified type arguments. An unbound type can’t be used in expressions other than typeof() and you can’t instantiate it or call its methods. For instance, List<> and Dictionary<,> are unbound types.

    To clarify the subtle distinction between an open type and an unbound type:

    class Program {
       static void Main() { Test<int>(); }
       static void Test<T>() {
          Console.WriteLine(typeof(List<T>)); // Print out the type name
       }
    }
    

    If you run this snippet, it’ll print out

    System.Collections.Generic.List`1[System.Int32]
    

    which is the CLR name for List<int>. It’s clear at runtime that the type argument is System.Int32. This makes List<T> a bound open type.

    At runtime, you can use reflection to bind type arguments to unspecified type parameters of unbound generic types with the Type.MakeGenericType method:

    Type unboundGenericList = typeof(List<>);
    Type listOfInt = unboundGenericList.MakeGenericType(typeof(int));
    if (listOfInt == typeof(List<int>))
         Console.WriteLine("Constructed a List<int> type.");
    

    You can check whether a type is an unbound generic type (generic type definition) from which you can construct bound types with the Type.IsGenericTypeDefinition property:

    Console.WriteLine(typeof(Dictionary<,>).IsGenericTypeDefinition); // True
    Console.WriteLine(typeof(Dictionary<int,int>).IsGenericTypeDefinition); // False
    

    To get the unbound type from a constructed type at runtime, you can use the Type.GetGenericTypeDefinition method.

    Type listOfInt = typeof(List<int>);
    Type list = listOfInt.GetGenericTypeDefinition(); // == typeof(List<>)
    

    Note that for a generic type, you can either have a completely unbound type definition, or a completely bound definition. You can’t bind some type parameters and leave others unbound. For instance, you can’t have Dictionary<int,> or Dictionary<,string>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 350k
  • Answers 350k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The two examples should be very similar in speed because… May 14, 2026 at 6:59 am
  • Editorial Team
    Editorial Team added an answer Unfortunately Java doesn't give you a good way to do… May 14, 2026 at 6:59 am
  • Editorial Team
    Editorial Team added an answer Used ICallbackEventHandler May 14, 2026 at 6:59 am

Related Questions

I am currently learning ASP.NET MVC so please excuse my question if it has
This is a shoutout as I've been spending the last few days learning about
After going through some tutorials on asp.net mvc the repository pattern came up and
I'm using the Data Annotation validation extensively in ASP.NET MVC 2. This new feature
We are getting ready to do a an initial deployment of an ASP.net MVC

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.