private void addPieces <P, S>( StyleMap styleMap, ParagraphType type, IList <P> paragraphList ) where P : Paragraph <S>, new() where S : struct { foreach (var style in styleMap) { var missingSizes = style.Value .Where(c => c.Value == 0) .ToList(); if (missingSizes.Any()) { addParagraph( type, paragraphList, (S)style.Key, $"{type}_{style.Key}" ); } foreach (var @char in missingSizes) { addParagraph( type, paragraphList, (S)style.Key, "".PadLeft(20, @char.Key) ); } } }
public static StyleMap New <T>(ParagraphType type) { var map = new StyleMap(); map.fill <T>(type); return(map); }