How to create an array of tuples?

in C# 7

var coords = new[] { ( 50, 350 ), ( 50, 650 ), ( 450, 650 )};

enter image description here

for named version, do this: (thanks entiat)

var coords2 = new(int X, int Y) [] { (50, 350), (50, 650), (450, 650) };

or

(int X, int Y) [] coords3 = new [] { (50, 350), (50, 650), (450, 650) };

or

(int X, int Y) [] coords4 = { (50, 350), (50, 650), (450, 650) };

so we can use X, Y instead of Item1, Item2

coords4.Select(t => $"Area = {t.X * t.Y}");

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)