Write an extension method for it;
public static class MyExtensions
{
public static void FillListView(this ListView listView, params string[][] col)
{
listView.Items.Clear();
listView.Columns.Clear();
for (int i = 0; i < col.Length; i++)
{
listView.Columns.Add("column" + i);
}
for (int i = 0; i < col.Length; i++)
{
var row = col.Select(p => p[i]).ToArray();
listView.Items.Add(new ListViewItem(row));
}
}
}
Then call it like this;
string[] c1 = new string[]{"a","b","c"};
string[] c2 = new string[] { "d", "e", "f" };
string[] c3 = new string[] { "g", "h", "i" };
listView1.FillListView(c1,c2,c3);
You can add any number of column. Element count check of columns is not implemented, you should do it.