98-372 · Question #106
Which of the following methods is inherited from the IComparable interface?
The correct answer is C. CompareTo. The CompareTo method is a member of the IComparable interface. The IComparable interface of the System namespace is used to define a generalized comparison method. When a value type or class implements this interface, it creates a type-specific comparison method that is the…
Question
Which of the following methods is inherited from the IComparable interface?
Options
- AGetType
- BDispose
- CCompareTo
- DClone
- EToString
How the community answered
(22 responses)- A14% (3)
- B5% (1)
- C77% (17)
- E5% (1)
Explanation
The CompareTo method is a member of the IComparable interface. The IComparable interface of the System namespace is used to define a generalized comparison method. When a value type or class implements this interface, it creates a type-specific comparison method that is the CompareTo method. The CompareTo method compares the current object of a class with another object of the same type. The IComparable interface is also suitable for the sorting Answer: E and A are incorrect. All classes inherit the ToString and GetType methods from the base Object class. Answer: B is incorrect. The Dispose method is a member of the IDisposable interface. Answer: D is incorrect. The Clone method is a member of the ICloneable interface.
Topics
Community Discussion
No community discussion yet for this question.