是的,簡單來講你的方法確實可用。但比較麻煩的是,必須先將Y 區分成Group後 在進行OrderBy 排序。 當排序完後,接著才去計算差值。因為資料都是亂數的,所以想透過LINQ的前置分組處理後 再詢問大家是否可以去計算相差的值呢?以下為示意。有什麼建議的方法嗎? 謝謝point .add(new Point(1,0)); point .add(new Point(7,0)); point .add(new Point(2,1)); point .add(new Point(6,1)); point .add(new Point(3,0)); point .add(new Point(5,0)); point .add(new Point(4,1)); point .add(new Point(9,0));
當排序完後,接著才去計算差值。因為資料都是亂數的,所以想透過LINQ的前置分組處理後
再詢問大家是否可以去計算相差的值呢?以下為示意。有什麼建議的方法嗎? 謝謝point .add(new Point(1,0));
point .add(new Point(7,0));
point .add(new Point(2,1));
point .add(new Point(6,1));
point .add(new Point(3,0));
point .add(new Point(5,0));
point .add(new Point(4,1));
point .add(new Point(9,0));