C# Programming - Generics - Discussion
Discussion Forum : Generics - General Questions (Q.No. 7)
7.
For the code snippet given below, which of the following statements are valid?
public class MyContainer<T> where T: IComparabte
{
// Insert code here
}
- Class MyContainer requires that it's type argument must implement IComparabte interface.
- Type argument of class MyContainer must be IComparabte.
- Compiler will report an error for this block of code.
- This requirement on type argument is called as constraint.
Discussion:
1 comments Page 1 of 1.
Angelpriya said:
9 years ago
Give explanation for this section.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers