首页 > Windows开发 > 详细

C# Array ConvertAll

时间:2019-12-18 18:49:55      阅读:111      评论:0      收藏:0      [点我收藏+]
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

原文:https://www.cnblogs.com/lgj1994/p/12061338.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!