Это класс: < /p>
Код: Выделить всё
class Berles
{
public int Uid { get; set; }
public int PaintingId { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int DailyPrice { get; set; }
public string Artist { get; set; }
public string Title { get; set; }
public int Duration => (EndDate - StartDate).Days;
public int TotalPrice => Duration * DailyPrice;
}
Код: Выделить всё
List berlesek = File.ReadAllLines("festmeny_berlesek_2024.csv")
.Skip(1)
.Select(sor =>
{
var t = sor.Split(',');
return new Berles
{
Uid = int.Parse(t[0]),
PaintingId = int.Parse(t[1]),
StartDate = DateTime.Parse(t[2]),
EndDate = DateTime.Parse(t[3]),
DailyPrice = int.Parse(t[4]),
Artist = t[5],
Title = t[6]
};
})
.ToList();
Подробнее здесь: https://stackoverflow.com/questions/796 ... -forms-app