Here is what I have at the moment:
public List<double> GetStrokeDashArray(List<double> dashLengths, double gap) { return dashLengths .SelectMany(dl => new[] { dl, gap }) .Take(dashLengths.Count * 2 - 1) .ToList(); }
Results for GetStrokeDashArray(new List<double> { 2, 4, 7, 11, 16 }, 2);
2, 2, 4, 2, 7, 2, 11, 2, 16
source share