BO4E.Extensions/BusinessObjects/Energiemenge/EnergiemengeExtension.cs
/// <summary>
///     test if Energiemenge has only one <see cref="Mengeneinheit" />
/// </summary>
/// <param name="em">Energiemenge</param>
/// <returns>true iff the Energiemenge-&gt;energieverbrauch list does only contain entries with mutually convertible units</returns>
test if Energiemenge has only one
test if Energiemenge has only one
public static bool IsPureMengeneinheit(this BO.Energiemenge em)
        {
            using (MiniProfiler.Current.Step(nameof(IsPureMengeneinheit)))
            {
                if (em.Energieverbrauch.Select(v => v.Einheit).Distinct().Count() <= 1) return true;
                var me1 = em.Energieverbrauch.Select(v => v.Einheit).First();
                return em.Energieverbrauch.Select(v => v.Einheit).All(me2 => me1.IsConvertibleTo(me2));
            }
        }
public static bool IsPureMengeneinheit ( this BO . Energiemenge em ) { using ( MiniProfiler . Current . Step ( nameof ( IsPureMengeneinheit ) ) ) { if ( em . Energieverbrauch . Select ( v => v . Einheit ) . Distinct ( ) . Count ( ) <= 1 ) return true ; var me1 = em . Energieverbrauch . Select ( v => v . Einheit ) . First ( ) ; return em . Energieverbrauch . Select ( v => v . Einheit ) . All ( me2 => me1 . IsConvertibleTo ( me2 ) ) ; } }
test if Energiemenge has only one
test if Energiemenge has only one
true iff the Energiemenge->energieverbrauch list does only contain entries with mutually convertible units
true iff the Energiemenge - > energieverbrauch list does only contain entries with mutually convertible units
BO.Energiemenge
this
em
None