C#泛型中,List<int>里的int部分的标准术语是什么?
Answer to Your C# Generic Terminology Question
Great question! In C#, that int you're referring to in List<int> or IEnumerable<int> has an official, standardized term: type argument.
Let me break this down to make it crystal clear:
- When we define a generic type (like the built-in
List<T>orIEnumerable<T>), the placeholderTis called a type parameter — it's just a stand-in for a type we'll specify later when using the generic. - When we create a concrete instance or declare a variable with that generic type (e.g.,
var v1 = new List<int>();orIEnumerable<int> v2 = someData;), the actual type we plug in place of the placeholder (here,int) is the type argument.
You might hear folks use loose phrases like "generic parameter" in casual conversation, but for precision (especially in documentation or technical discussions), it’s important to draw the line between the placeholder (T, type parameter) and the real type you supply (int, type argument). This terminology is consistent across C#'s official specs and the broader .NET ecosystem.
内容的提问来源于stack exchange,提问作者Laurence Frost
相关产品推荐
相关产品推荐

