Managing Complex Multi-Level Menu’s within C# Console App

As the title suggests, I’m trying to find an efficient way to handle a complex branching C# Console App. I am currently a student, so I’m limited to some functionality that I’ve learned. I need to either accomplish this with methods, class objects, or hard coding. Presently I’m trying to avoid hard-coding it because a ton of while loops is aggravating and looks ugly. So here is the format for the menu’s.

Enter Activity

> Pick Category

> Back

>> Pick Description

>> Back

>>> Date Activity Performed

>>> Back

>>>> Accept Input from (DateActivity Performed)

>>>> Enter Another Activity

>>>> Back

View Tracked Data

> Select By Date

>> List Activities By Dates

>> Back

>>> Enter Activity For This Day? (Move to Enter Activity)

>>> Back

> Select By Category

>> List Categories

>> Back

> Select By Description

>>List Descriptions

>> Back

>>>Display Selected Description


ETC….. (This Goes On For A While)

Obviously, I have tried the following.

bool programRunning = true; while (programRunning) { Console.Clear(); Console.WriteLine("Some Menu Options"); string userSelection = Console.ReadLine(); switch (userSelection) { Case "1": { //Do Some Code break; } } } 

But this is NOT efficient or clean enough for my liking. Any thoughts? BTW, I have no clue how to use a lambda “=>”

For the sake of my grade, let’s leave libraries out of this.

submitted by /u/xTwiisteDx
[link] [comments]

Leave a Reply