In C# Documentations, there was an example under constructed types where they use class Queue , what is TElement and what does it mean /represent?
Asked
Active
Viewed 70 times
1 Answers
0
It's a placeholder for whatever type you wish to specify.
It could be Queue<string> or Queue<int> or Queue<List<int> or Queue<SomeComplicatedClass> - whatever you like.
It's called a "generic type parameter" (the bit between the < and the >).
The docs page has the following example:
Queue<string> numbers = new Queue<string>();
numbers.Enqueue("one");
numbers.Enqueue("two");
numbers.Enqueue("three");
numbers.Enqueue("four");
numbers.Enqueue("five");
You can read more about generic type parameters here.
ProgrammingLlama
- 36,677
- 7
- 67
- 86