linq in List< list< string>>任何功能都不给出正确的响应
失去理智,尝试使用更简单的东西,并做任何工作的功能。 我意识到我不需要将x,y转换为字符串,但这也不适合点。 函数“独特”不是一个选择,我会从更大的类中过滤这些坐标。此功能是一个简单的检查,即可避免使用真正复杂的LINQ功能。
public static List<PXML_DocumentOrderProductSlabOutline> FilterMountpart21(List<PXML_DocumentOrderProductSlabOutline> Mountpart21Lijst)
{
List<PXML_DocumentOrderProductSlabOutline> Gefilterd = new List<PXML_DocumentOrderProductSlabOutline>();
List<List<string>> GefilterdeSparingen = new List<List<string>>();
for (int x = 0; x < Mountpart21Lijst.Count; x++)
{
var ShapeMountpart21Lijst = Mountpart21Lijst[x].Shape.First().SVertex;
List<string> LijstVertex = new List<string>();
foreach (var xyz in ShapeMountpart21Lijst)
{
string Punt = Convert.ToInt32(xyz.X) + ";" + Convert.ToInt32(xyz.Y);
LijstVertex.Add(Punt);
}
//This fails
if(!GefilterdeSparingen.Any(abc => abc == LijstVertex))
//
{
GefilterdeSparingen.Add(LijstVertex);
Gefilterd.Add(Mountpart21Lijst[x]);
System.Windows.MessageBox.Show(ResultaatFilterMountpart21(LijstVertex, GefilterdeSparingen));
}
}
return Gefilterd;
}
Losing my mind, tried it with something more simple and the function ANY does work ofcourse.
I realise I don't need to convert X,Y to strings, but it didn't work either with points.
Function 'Distinct' isn't an option, I filter those coordinates from a much larger class. This function is a simple check to not add doubles, to avoid a really complex LINQ function.
public static List<PXML_DocumentOrderProductSlabOutline> FilterMountpart21(List<PXML_DocumentOrderProductSlabOutline> Mountpart21Lijst)
{
List<PXML_DocumentOrderProductSlabOutline> Gefilterd = new List<PXML_DocumentOrderProductSlabOutline>();
List<List<string>> GefilterdeSparingen = new List<List<string>>();
for (int x = 0; x < Mountpart21Lijst.Count; x++)
{
var ShapeMountpart21Lijst = Mountpart21Lijst[x].Shape.First().SVertex;
List<string> LijstVertex = new List<string>();
foreach (var xyz in ShapeMountpart21Lijst)
{
string Punt = Convert.ToInt32(xyz.X) + ";" + Convert.ToInt32(xyz.Y);
LijstVertex.Add(Punt);
}
//This fails
if(!GefilterdeSparingen.Any(abc => abc == LijstVertex))
//
{
GefilterdeSparingen.Add(LijstVertex);
Gefilterd.Add(Mountpart21Lijst[x]);
System.Windows.MessageBox.Show(ResultaatFilterMountpart21(LijstVertex, GefilterdeSparingen));
}
}
return Gefilterd;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论