C# Programming - Generics - Discussion

Discussion Forum : Generics - General Questions (Q.No. 8)
8.
For the code snippet given below, which of the following statements are valid?
public class MyContainer<T> where T: class, IComparable
{
    //Insert code here
}
  1. Class MyContainer requires that it's type argument must implement IComparable interface.
  2. Compiler will report an error for this block of code.
  3. There are multiple constraints on type argument to MyContainer class.
  4. Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.
1 and 2 Only
3 and 4 Only
2 and 3 Only
All of the above
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Santo said:   8 years ago
We couldn't understand the question?

Gloops said:   9 years ago
How is it possible to say that 4 is true and 1 is false ?

I should have said 3 and 4, but surely not 3 and 4 only.

Post your comments here:

Your comments will be displayed after verification.