private CodeTypeDeclaration GetOrCreateClass(string className, CodeTypeMemberCollection members) { var @class = members.ToEnumerable <CodeTypeDeclaration>() .FirstOrDefault(_class => _class.Name == className); if (@class == null) { @class = new CodeTypeDeclaration(className) { TypeAttributes = TypeAttributes.Public | TypeAttributes.Sealed, IsClass = true }; if (generateXmlDocumentation) { CustomizationService.AddMissingXmlDocumentation(className, @class.Comments); } members.Add(@class); } return(@class); }