C#語言中如何使用Point 類型數組

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;
        }
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章