C#语言中如何使用Point 类型数组

来源:互联网 发布:单片机usb 串口 编辑:程序博客网 时间:2024/06/10 03:03
class Program
    {
        static void Main(string[] args)
        {
            Point[] ArrPoint = new Point[30];
            for (int i = 0; i < 30; i++)
            {
                ArrPoint[i].X = i;
                ArrPoint[i].Y = i * 2;//任意赋值的!
            }

            Point p = GetPoint(3,ref ArrPoint);
            Console.WriteLine(p.X.ToString() + ", "+p.Y.ToString());
        }

        static Point GetPoint(int index,ref Point[] ArrPoint)
        {
            Point p = new Point();
            if (index < ArrPoint.Length)
            {
               p=     ArrPoint[index];
            }
            return p;
        }
    }
原创粉丝点击