lgj1994

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));
    }
}

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-12-28
  • 2021-12-18
  • 2021-12-19
  • 2021-12-28
  • 2022-01-20
  • 2021-12-18
  • 2021-12-19
猜你喜欢
  • 2021-12-23
  • 2021-11-17
  • 2021-09-05
  • 2021-09-17
  • 2021-11-12
  • 2022-01-20
  • 2021-12-18
  • 2021-12-05
相关资源
相似解决方案