Home > front end >  List with multiple data type
List with multiple data type

Time:11-17

date of delivery compagny name quantity
11-15-2019 moon 450
01-01-2010 sun 10

I want to create a list for the above table but my code doesn't seem to work. The <deliv> is highlited red and I get the error message cs0246:

listdelivery = new List<deliv>();
listdelivery.Add(new deliv() { datedeliv = "11 - 15 - 2019", Compagny = "Moon", quantity = "450" });
listdelivery.Add(new deliv() { datedeliv = "01 - 01 - 2010", Compagny = "Sun", quantity = "10" });

I'm trying to use the list to search for deliveries using the date as an input, I clearly did something wrong but I cant seem to find it and I do not know what to look for on the internet.

CodePudding user response:

I am guessing you need to create your deliv type as some kind of DTO with date, name and quantity fields. And also, as suggested earlier, if you want proper search by date, then Date field of your deliv type should be DateTime

  • Related