Choose the correct statement about the IComparer<T> interface in C#?

Choose the correct statement about the IComparer<T> interface in C#?
A. The IComparer<T> is in System.Collections.Generic
B. It defines a generic form of Compare()
C. Only The IComparer<T> is in System.Collections.Generic
D. Both The IComparer is in System.Collections.Generic & It defines a generic form of Compare()
 
Answer: d
Explanation: IComparer<T> is in System.Collections.Generic. It defines a generic form of Compare(), which is shown here:
int Compare(T x, T y). It works the same as its non-generic relative: returning greater than zero if x is greater than
y, less than zero if x is less than y, and zero if the two values are equal.
 

Tìm kiếm

Back
Top