C#-এ অ্যারে ডিফাইন করতে −
int[] runs = new int[10];
এখন একই লাইনে অ্যারে ইনিশিয়ালাইজ করুন −
int[] runs = new int[5] {99, 92, 95};অ্যারে ডিক্লেয়ার, ইনিশিয়ালাইজ এবং ডিসপ্লে করার উদাহরণ নিচে দেওয়া হলো −
উদাহরণ
using System; namespace Program { class Demo { static void Main(string[] args) { int[] runs = new int[3] {149, 123, 257}; int j; for (j = 0; j < 3; j++ ) { Console.WriteLine("Score of Cricketer[{0}] = {1}", j, runs[j]); } Console.ReadKey(); } } }