C# Array ConvertAll

using System;
using System.Drawing;
using System.Collections.Generic;

public class Example
{
    public static void Main()
    {
        PointF[] apf = {
            new PointF(7.8F, 3.2F),
            new PointF(9.3F, 7.73F),
            new PointF(7.5F, 2.2F) };

        Point[] ap = Array.ConvertAll(apf, new Converter<PointF, Point>(PointFToPoint));
        foreach( Point p in ap )
        {
            Console.WriteLine(p);
        }
    }

    public static Point PointFToPoint(PointF pf)
    {
        return new Point(((int) pf.X), ((int) pf.Y));
    }
}

C# Array ConvertAll

上一篇:Windows Server 2008通过计划任务定时执行bat文件


下一篇:xlwings结合dataframe数据的写入