ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Point 정렬
    카테고리 없음 2015. 12. 9. 22:20
    void exam2()
    {            
    	PointF[] arrPoint = { new PointF(3,4), new PointF(9,3),  new PointF(7,4) };                       
    	foreach (PointF item in arrPoint)
    	{
    		Console.WriteLine("{0}", item);
    	}
    	Console.WriteLine();
    	var sortedlist = from point in arrPoint
    					 where point.X > 1
    					 orderby point.X ascending 
    					 select point;
    
    	foreach (PointF item in sortedlist)
    	{
    		Console.WriteLine("{0}", item );
    	}
    	Console.WriteLine();
    
    	sortedlist = from point in arrPoint
    					 where point.X > 1
    					 orderby point.X descending 
    					 select point;
    
    	foreach (PointF item in sortedlist)
    	{
    		Console.WriteLine("{0}", item);
    	}
    	Console.WriteLine();
    	Console.ReadKey();
    }

    {X=3, Y=4}

    {X=9, Y=3}

    {X=7, Y=4}


    {X=3, Y=4}

    {X=7, Y=4}

    {X=9, Y=3}


    {X=9, Y=3}

    {X=7, Y=4}

    {X=3, Y=4}



Designed by Tistory.