/// <summary> /// Creates a field that holds information about property groups for the given module. /// </summary> protected FieldDeclarationSyntax CreatePropsField(IEnumerable <PropertyGroup> propertyGroups) { var initializers = from pg in propertyGroups from p in pg.Properties group pg.Name by p.Name into g select new[] { SyntaxEx.Literal(g.Key), SyntaxEx.ArrayCreation(null, g.Select(SyntaxEx.Literal)) }; var propsInitializer = SyntaxEx.ObjectCreation("Dictionary<string, string[]>", null, initializers); var propsField = SyntaxEx.FieldDeclaration( new[] { SyntaxKind.PrivateKeyword, SyntaxKind.StaticKeyword, SyntaxKind.ReadOnlyKeyword }, "IDictionary<string, string[]>", ClassNameBase + "Props", propsInitializer); return(propsField); }