Game.City.CityService
Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 mods — actual assembly may vary)
Namespace: Game.City
Type: public enum CityService
Base: System.Enum
Summary:
Enumeration representing the different high-level city services used by the game (Cities: Skylines 2). Each member identifies a service area (for example, Electricity or Roads) that game systems, UI, managers, or arrays can index or reference. The final member Count
is a sentinel used to represent the number of defined services and is commonly used for sizing arrays or iterating all services.
Fields
-
Communications
Represents communications-related services (e.g., messaging, inter-city links). Underlying integer value: 0. -
Districts
Represents district management services. Underlying integer value: 1. -
Education
Represents education services (schools, universities). Underlying integer value: 2. -
Electricity
Represents electrical power services (generation, distribution). Underlying integer value: 3. -
FireAndRescue
Represents fire and rescue services (fire stations, emergency rescue). Underlying integer value: 4. -
GarbageManagement
Represents garbage collection and waste management services. Underlying integer value: 5. -
HealthcareAndDeathcare
Represents healthcare and deathcare services (hospitals, crematoriums, cemeteries). Underlying integer value: 6. -
Landscaping
Represents landscaping services/operations. Underlying integer value: 7. -
ParksAndRecreation
Represents parks, recreation, and leisure services. Underlying integer value: 8. -
PoliceAndAdministration
Represents police and administrative services (police stations, city admin). Underlying integer value: 9. -
Roads
Represents road network and maintenance services. Underlying integer value: 10. -
Transportation
Represents public transportation services (buses, metros, etc.). Underlying integer value: 11. -
WaterAndSewage
Represents water supply and sewage services. Underlying integer value: 12. -
Zones
Represents zoning services (residential, commercial, industrial zones). Underlying integer value: 13. -
Count
Sentinel value representing the number of services in the enum. Underlying integer value: 14. Commonly used to size arrays or bounds-check iterations.
Properties
- None. (This is a plain enum type with no properties.)
Constructors
- None explicitly declared. (Enums have implicit constructors provided by the runtime.)
Methods
- None declared on this enum type. (Standard Enum methods from System.Enum are available, e.g., ToString(), Parse, GetValues, etc.)
Usage Example
// Typical usage patterns for this enum:
// 1) Size arrays or collections by Count
bool[] serviceEnabled = new bool[(int)CityService.Count];
serviceEnabled[(int)CityService.Electricity] = true;
// 2) Iterate all services
for (int i = 0; i < (int)CityService.Count; i++)
{
CityService service = (CityService)i;
Console.WriteLine($"Service #{i}: {service}");
}
// 3) Switch on a service value
void HandleService(CityService service)
{
switch (service)
{
case CityService.Electricity:
// handle electricity-specific logic
break;
case CityService.Roads:
// handle roads-specific logic
break;
// ...
default:
break;
}
}
// 4) Parse from string (when reading from config/UI)
if (Enum.TryParse<CityService>("HealthcareAndDeathcare", out var parsed))
{
// use parsed
}
File location: Game\City\CityService.cs
Notes:
- Values are default 0-based sequential integers unless modified in the source.
- Count
is useful to ensure arrays and loops remain correct when members are added/removed; keep in sync with the enum members.