Initialize Array with Array Initializer and Anonymous Type

Below is a sample code snippet demonstrating how to initialize an array with Array Initializer and anonymous type

Initialize Array with Array Initializer and Anonymous Type

using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

namespace AbundantCode

{

internal class Program

{

//Initialize Array with Array Initializer and Anonymous Type

private static void Main(string[] args)

{

var arry = new int[] { 1, 2, 6, 78, 100 };

foreach (var arr in arry)

Console.WriteLine(arr);

Console.ReadLine();

}

}

}
Initialize Array with Array Initializer and Anonymous Type