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
}
  1. Class MyContainer requires that it's type argument must implement IComparabte interface.
  2. Type argument of class MyContainer must be IComparabte.
  3. Compiler will report an error for this block of code.
  4. This requirement on type argument is called as constraint.
1 and 2 Only
1, 2 and 3 Only
1 and 4 Only
All of the above
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
1 comments Page 1 of 1.

Angelpriya said:   9 years ago
Give explanation for this section.

Post your comments here:

Your comments will be displayed after verification.