Get index of lines that match my linq

前端 未结 3 1649
我寻月下人不归
我寻月下人不归 2021-01-25 21:45

I have a linq statement and I would like to know if it is possible to get indicies of lines that match my statement? Here it is:

var result = list3.Where(middle          


        
3条回答
  •  面向向阳花
    2021-01-25 22:26

    do you mean this?

    var result = list3.Where(middle => list4.Any(x => x == middle.Middle.category1))
               .Select(obj => new { obj, dt = DateTime.ParseExact(obj.LeftColumn, dateFormat, CultureInfo.InvariantCulture) })
               .Where(x => x.dt >= czas11 && x.dt <= czas22)
               .Select((x,index) =>new{ x.obj,Index=index}).ToList();
    

提交回复
热议问题