From c49b238268712578c1f7a4a77e6866a6e87c05bd Mon Sep 17 00:00:00 2001 From: "VKMTHD\\haraldmartini" <harald.martini@student.tugraz.at> Date: Wed, 15 Feb 2023 15:25:59 +0100 Subject: [PATCH] added DebuggerStepThrough Attribute to some enumerable extension methods --- .../VectoCommon/Utils/EnumerableExtensionMethods.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs index ac41e30a9a..55a880f723 100644 --- a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using TUGraz.VectoCommon.Models; @@ -156,15 +157,17 @@ namespace TUGraz.VectoCommon.Utils } } } - + [DebuggerStepThrough] public static T Sum<T>(this IEnumerable<T> values) where T : SIBase<T> => values.Sum(x => x); - public static TResult Sum<TU, TResult>(this IEnumerable<TU> values, Func<TU, TResult> selector) + [DebuggerStepThrough] + public static TResult Sum<TU, TResult>(this IEnumerable<TU> values, Func<TU, TResult> selector) where TResult : SIBase<TResult> => values.Select(selector).DefaultIfEmpty().Aggregate((sum, current) => sum + current); - public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> => + [DebuggerStepThrough] + public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> => values.Average(v => v.Value()).SI<T>(); /// <summary> -- GitLab