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

  • SEARCH
  • Home
  • 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 6193251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:05:12+00:00 2026-05-24T03:05:12+00:00

i was wondering if there’s a way to build a class which can accept

  • 0

i was wondering if there’s a way to build a class which can accept multiple generic arguments
that aren’t known at compile time

   class Something<T,V,U> 

this example shows a class which would expect to receive 3 generic arguments at run time.
i’m looking for a way to specify a class which would except multiple arguments of a varied amount

something along the line of

    class Something<T[]> 

which i could later expose using reflection

  Type [] types = GetType().GetGenericArguments(); 
  • 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-24T03:05:12+00:00Added an answer on May 24, 2026 at 3:05 am

    You can make some class – a kind of

    public static class TypeHelper
    {
        public static IEnumerable<Type> GetTypeCombination(this Type type)
        {
            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(T<,>))
                return type.GetGenericArguments().SelectMany(GetTypeCombination);
    
            return new Type[] { type };
        }
    }
    
    public class T<T1, T2>
    {
        public static IEnumerable<Type> GetTypeCombination()
        {
            return typeof(T1).GetTypeCombination()
                .Concat(typeof(T2).GetTypeCombination());
        }
    }
    

    and to use that as

    var list = T<int, T<string, int[]>>.GetTypeCombination().ToList();
    

    to get (pass) dynamic list of types – not sure it’s the best way

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

Sidebar

Related Questions

Wondering if there is any way to get the lambda expressions that result from
Wondering if there is a good way to generate temporary URLs that expire in
Wondering if there is any tool that can help me to detect a pronoun's
Just wondering is there any way I can check whether the url links to
Wondering if there is a way I could trigger an event, so that any
HI there I was wondering if there is a better way of testing that
Wondering if there is any way to build and fire an event (e.g. on
Wondering if there’s a plugin or best way of setting up an ActiveRecord class
Wondering if there is some preference I can set in excel so that when
Am wondering if there is any applet which I can use and customize to

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.