是否可以将数组添加到数据源变量?c#

是否可以将数组添加到数据源变量?c#,c#,datagridview,datasource,C#,Datagridview,Datasource,我的目标是在dataGridView.DataSrouce中使用两个独立的数组,一个字符串数组和一个int数组,但我不知道如何,或者是否有可能做到这一点 // this is what i have now dataGridView.DataSource = playerName.Select(x => new { PlayerName = x }).ToList(); //this is what im looking to do, if it makes an

我的目标是在dataGridView.DataSrouce中使用两个独立的数组,一个字符串数组和一个int数组,但我不知道如何,或者是否有可能做到这一点

// this is what i have now
dataGridView.DataSource = playerName.Select(x =>
            new { PlayerName = x }).ToList();

//this is what im looking to do, if it makes any sense
dataGridView.DataSource = playerName.Select(k =>
            new { PlayerName = k, plrRoll = playerRoll.Select(x => 
                new { roll = x }) }).ToList();
目前它只打印plrRoll列中的空行


是否可以将用户生成的卷和用户生成的名称放在一起并显示在dataGridView中?

dataGridView
可以显示
表格数据
而不是
层次数据
我还有其他方法可以这样做吗?正如我所说,您可能需要将
层次数据
转换为
表格数据
,并接受某些列中可能存在重复值的事实。另一种选择是使用一些自定义的
DataGridView
,它支持显示
父子关系数据
。您还可以使用2个
DataGridView
,1个用于
parent
,1个用于
child
。是的,目前我正在使用2个单独的DataGridView,但我最终想要实现的目标是能够组织数据、卷和名称,以便它们从高值到低值一起显示。