2021-12-15 12:43:51 +03:00

21 lines
578 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace EvoCalculator.Core.Tools.GroupColumns;
public static partial class GroupColumns
{
public static List<KeyValuePair<DateTime, decimal>>
Merge(params List<KeyValuePair<DateTime, decimal>>[] pairs)
{
return pairs.Length switch
{
> 1 => pairs
.SelectMany(pair => pair)
.Select((x, i) => new KeyValuePair<DateTime, decimal>(x.Key, x.Value))
.ToList(),
_ => pairs.FirstOrDefault()
};
}
}