Binding DataGridView using Mutidimension Array

I would like to share a way by which we can bind Datagridview using Multidimension array.

Steps

a. Defining Array

string[][] Array = new string[100][];

b. Setting Values


for(int i = 0; i < 100; i++) {

 Array[i] = new string[2] { "ROLI:"+i, "DEVESH:"+i };

 
c. Binding Datagridview using Linq

dataGridView1.DataSource = (
from arr in Array select new { Column_1 = arr[0], Column_2 = arr[1] }).ToList();

 
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now