I have a csv with 2 columns the first one with a string and the second with the start and end time (ex: 11:00-22:00). How would you filter the fields containing the time of 14:00 for example, as performatively as possible?
For example :
RestaurantName OpenHours
Kushi Tsuru 11:30-21:00
Osakaya Restaurant 11:30-21:00
The Stinking Rose 9:00-22:00
I write 21:30 and would show The Stinking Rose, or if i write 11:00 show Kushi Tsuru, Osakaya Restaurant and The Stinking Rose on console.
class Filter
{
static void Main(string[] args)
{
List<Restaurant> csvFile = File.ReadAllLines(@"C:\restaurant-hours.csv")
.Skip(1)
.Select(Restaurant.FromCsv)
.ToList();
void filter_by_hour()
{
Console.WriteLine("\nEnter the hour");
string Dateofbirth = (Console.ReadLine();
var filter_data = csvFile.Where(e => (DateTime.Parse(e.OpenHour)) > Dateofbirth)
.Select(e => e);
}
}
}