Hi all, first of all thank you to everyone who helped me out last night with my problems, now I need some help again.

I have a menu and submenu system, this submenu contains information about locating a driver's location, I want to be able to do a search within the if statement to find out where said Driver is located. I've attached a link to a screenshot if that helps.


I want to be able to press the number 1 (or any other number) and for the application to say the following instead of defaulting back to the depot menu:

Please enter name of driver (in this case Steven)
Then for the application to say:

"Steven is located at Depot A"

Any ideas, tips or suggestions greatly appreciated.
I don't want the coding done for me as this is cheating, I just want a pointing in the right direction


6 Years
Discussion Span
Last Post by skatamatic

Looks like you will need to search by name for a driver in your list of depots. There's a few ways to do this - are you familiar with LINQ?

var FindDriverDepots = from x in mydepots
                       where (x.drivers.FindAll(y => y.name == "Steven").Count != 0)
                       select x;

This will give you a list of depots that contain drivers with the name "Steven"

Or are you asking how to get the user input (ie Console.Readline() )?

Edit: This will likely run faster in a long list of depots/drivers

var FindDriverDepots = mydepots.FindAll(x => x.drivers.Find(y => y.name == "Steven") != null);

Edited by skatamatic: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.