您的位置:首页 > 编程语言 > C#

C# Array ConvertAll

2019-12-18 18:17 2246 查看
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));
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: