Вы можете придумать что-то вроде этого:
var l = new List<Test>
{
new Test { SectionName = "Cat 1", Status = "Opening", SingleValue = 0, CoupleValue = 0, FamilyValue = 0 },
new Test { SectionName = "Cat 1", Status = "Current", SingleValue = 1, CoupleValue = 1, FamilyValue = 1 },
new Test { SectionName = "Cat 1", Status = "Closing", SingleValue = 2, CoupleValue = 2, FamilyValue = 2 },
new Test { SectionName = "Cat 2", Status = "Opening", SingleValue = 0, CoupleValue = 0, FamilyValue = 0 },
new Test { SectionName = "Cat 2", Status = "Current", SingleValue = 1, CoupleValue = 1, FamilyValue = 1 },
new Test { SectionName = "Cat 2", Status = "Closing", SingleValue = 2, CoupleValue = 2, FamilyValue = 2 },
};
const string strValue = "Value";
var cats = l.Select(x => x.SectionName).Distinct().ToArray();
var catNo = cats.Length;
var valProps = new Test().GetType().GetProperties().Where(p => p.Name.EndsWith(strValue)).ToArray();
var vals = valProps.Select(p => p.Name.Split(strValue).First()).ToArray();
var valsNo = vals.Length;
var elNo = catNo * valsNo;
var dictOpClCu = l.GroupBy(t => t.Status).ToDictionary(g => g.Key, g => g
.SelectMany(t => valProps.Select(p => (int) p.GetValue(t, null))).ToArray());
var l2 = new List<Test2>();
var currCat = -1;
var currVal = -1;
for (var i = 0; i < elNo; i++)
{
l2.Add(new Test2
{
Section = cats[i % (elNo / catNo) != 0 ? currCat : ++currCat],
ValueLabel = vals[++currVal % valsNo],
OpeningValue = dictOpClCu["Opening"][i],
ClosingValue = dictOpClCu["Closing"][i],
CurrentValue = dictOpClCu["Current"][i]
});
}
Терст классы:
public class Test
{
public string SectionName { get; set; }
public string Status { get; set; }
public int SingleValue { get; set; }
public int CoupleValue { get; set; }
public int FamilyValue { get; set; }
}
public class Test2
{
public string Section { get; set; }
public string ValueLabel { get; set; }
public int OpeningValue { get; set; }
public int CurrentValue { get; set; }
public int ClosingValue { get; set; }
public override string ToString() => $"{Section} | {ValueLabel} | {OpeningValue} | {CurrentValue} | {ClosingValue}";
}