Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active Nov 2, 2020
Embed
What would you like to do?
ジェネリックで制約を設定する
/// <Summary>
/// 引数の値を比較するメソッドです。
/// </Summary>
T GetLargerValue<T>(T a, T b)
where T: IComparable
{
if (a.CompareTo(b) > 0)
{
return a;
}
else
{
return b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment