diff --git a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs
index 1cfb944..85907c0 100644
--- a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs
+++ b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs
@@ -1305,6 +1305,33 @@ namespace ICD.Common.Utils.Extensions
}
}
+ ///
+ /// Returns the maximum value from the sequence, otherwise the default value.
+ ///
+ ///
+ ///
+ ///
+ public static T MaxOrDefault([NotNull] this IEnumerable extends)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ Comparer comparer = Comparer.Default;
+ T value = default(T);
+
+ using (IEnumerator enumerator = extends.GetEnumerator())
+ {
+ while (enumerator.MoveNext())
+ {
+ T x = enumerator.Current;
+ if (comparer.Compare(x, value) > 0)
+ value = x;
+ }
+ }
+
+ return value;
+ }
+
///
/// Computes the sum of a sequence of byte values.
///