How to initialize an array of Point?

arrays, c#, constructor, initialization, point

Solution

Here is the code for creating the array of 3 different points:

Point[] points = new Point[] { new Point { X = 0, Y = 1 }, new Point { X = 2, Y = 1 }, new Point { X = 0, Y = 3 } };

Problem

I need to initialize an array of three points. I want to write it like below, but only once for three elements. ``` Point P = new Point { X = 0, Y = 1 }; Point[] P = new Point[3];// <---- ? ``` How to write correctly?

Original source

Related problems