Skip to main content

Practice · 1 of 3

A Generic Max That Can Actually Compare

CHALLENGE
Difficulty: intermediate+25 XP

Implement Max: returns the largest of two values for any type that knows how to compare itself. A null argument makes it return the other one (both null returns default). ``csharp static T? Max<T>(T? a, T? b) where T : IComparable<T>; ``

Back to lesson: Practice: Generic Design Practice