public void GenerateProperties(IReadOnlyCollection <JsonProperty> properties, int indentLevel, CodeBuilder classBuilder) { var propertyHashFactory = new PropertyHashFactory(); var propertyHash = propertyHashFactory.FindBestHash(properties.Select(p => p.JsonName).ToArray()); var hashesQuery = from property in properties let hash = propertyHash.Hash(property.JsonName) group property by hash into hashGroup orderby hashGroup.Key select hashGroup; var hashes = hashesQuery.ToArray(); var switchGroups = FindSwitchGroups(hashes); foreach (var switchGroup in switchGroups) { GenerateSwitchGroup(switchGroup, classBuilder, indentLevel, propertyHash); } }