我是新手,如果你发现这个问题很愚蠢,我会要求耐心。但我真的需要帮助来解决这个问题。我有一个带有起点和终点的行列表,但是如果起点和终点与其他点的端点和起点相同,我需要消除一个。感谢那些愿意回答这个问题的人。这个网站对我很有帮助。
private void sample()
{
SampleLine sl = new SampleLine();
List<SampleLine> listLines = new List<SampleLine>();
listLines.Add(new SampleLine { StartPoint = new Point(0, 250), EndPoint = new Point(150, 100)}); //[0]
listLines.Add(new SampleLine { StartPoint = new Point(100, 350), EndPoint = new Point(250, 200) }); //[1]
listLines.Add(new SampleLine { StartPoint = new Point(200, 500), EndPoint = new Point(350, 650) }); //[2]
listLines.Add(new SampleLine { StartPoint = new Point(300, 550), EndPoint = new Point(450, 400) }); //[3]
listLines.Add(new SampleLine { StartPoint = new Point(350, 650), EndPoint = new Point(200, 500) }); //[4]
listLines.Add(new SampleLine { StartPoint = new Point(500, 750), EndPoint = new Point(650, 600) }); //[5]
//From Above, index 2 and index 4 should be treated as the same and index 4 be deleted in the list
/*
listLines.Add(new SampleLine { StartPoint = new Point(200, 500), EndPoint = new Point(350, 650) }); //[2]
listLines.Add(new SampleLine { StartPoint = new Point(350, 650), EndPoint = new Point(200, 500) }); //[4] startpoint[4] is equal to endpoint[2] and endpoint[4] is equal to startpoint[2]
//index [4] should be deleted since it is cross equal with index[2]
*/
}