O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example – yearly transport plan

After the introduction of jagged arrays, let's proceed with an example. You will see how to develop a program that creates a plan of transportation for the whole year. For each day of each month, the application draws one of the available means of transport. At the end, the program presents the generated plan, as shown in the following screenshot:

To start with, let's declare the enumeration type with constants representing available types of transport, namely a car, a bus, a subway, a bike, or on foot, as follows:

public enum TransportEnum 
{ 
    CAR, 
    BUS, 
    SUBWAY, 
    BIKE, 
    WALK 
} 

In the next step, you create two extension ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required