if (items == null || items.Length == 0) C# compiler makes check on null them self, so if (items.Length == 0) is enought. max = items[i].CompareTo(max) > 0 ? items[i] : max; is slower then if (max.CompareTo(items[i]) < 0) max = items[i];
I love var more then T because code can be copied and paste to another place without changing.
Thanks for explaining your choices :)
if (items == null || items.Length == 0)
C# compiler makes check on null them self, soif (items.Length == 0)
is enought.max = items[i].CompareTo(max) > 0 ? items[i] : max;
is slower thenif (max.CompareTo(items[i]) < 0) max = items[i];
I love
var
more thenT
because code can be copied and paste to another place without changing.