Beginning C# 7 Hands-On:Advanced Language Features
上QQ阅读APP看书,第一时间看更新

Comparing values using the CompareTo method

Now, let's do one more method. This one will be a little more sophisticated. It will be called Compare, and it will operate on different data types. So, enter the following beneath the closed curly brace at the end of the preceding lines:

public static string Compare<T>(T x, T y) where T : IComparable