c# - Limit on amount of generic parameters in .NET?

ID : 274524

viewed : 34

Tags : c#.netgenericsc#





Top 3 Answer for c# - Limit on amount of generic parameters in .NET?

vote vote

96

From the C# 2.0 language spec

8.16.3 Multiple type parameters Generic type declarations can have any number of type parameters.

vote vote

83

Anonymous types in C# 3.0 are actually generic, for reasons which I should probably blog about at some point. When we designed anonymous types we realized that of course people could be creating anonymous types with potentially hundreds of fields, so we did a lot of testing of the performance of generics with lots of type parameters.

We didn't find any notable problems.

However, what we consider acceptable, you might not. My advice: try it and see. Write up some benchmarks, execute them, and then you'll be reasoning from empirical data, rather than reasoning from the guesses of random people on the internet who don't know what your user scenarios are or what performance factors are important to you.

vote vote

75

Top 3 video Explaining c# - Limit on amount of generic parameters in .NET?







Related QUESTION?