c# linq 搜索嵌套列表和结构
c# linq search with nested list and struct
我有一个结构
public struct one_point
{
public int X { get; set; }
public int Y { get; set; }
public int _value{ get; set; }
}
和 2 个列表
List<one_point> rotation_list = new List<one_point>();
List<List<one_point>> Full_list = new List<List<one_point>>();
如果我想要 List<one_point> result
这是 _value 小于 50
的所有点的列表
如何查询?类似 ;
IEnumerable<one_point> result = Full_list.Where(y => y.SelectMany(z => z._value < 50));
在对其进行任何条件检查之前展平列表。
IEnumerable<one_point> result = Full_list.SelecetMany(x => x).Where(x => x._value < 50);
我有一个结构
public struct one_point
{
public int X { get; set; }
public int Y { get; set; }
public int _value{ get; set; }
}
和 2 个列表
List<one_point> rotation_list = new List<one_point>();
List<List<one_point>> Full_list = new List<List<one_point>>();
如果我想要 List<one_point> result
这是 _value 小于 50
如何查询?类似 ;
IEnumerable<one_point> result = Full_list.Where(y => y.SelectMany(z => z._value < 50));
在对其进行任何条件检查之前展平列表。
IEnumerable<one_point> result = Full_list.SelecetMany(x => x).Where(x => x._value < 50);