由网友(温一壶月光当茶饮)分享简介:我有一个的IList<字符串> 从函数返回(如可变LST),我设定,然后我I have an IList returning from a function (as variable lst) and I set and then I this.dataGridView1.DataS...
我有一个的IList<字符串>
从函数返回(如可变LST),我设定,然后我
I have an IList<string>
returning from a function (as variable lst) and I set and then I
this.dataGridView1.DataSource = lst;
数据网格添加一列标记的长度,然后列出每个串的长度。 我如何让它只列出了弦?
The datagrid adds one column labelled Length and then lists the length of each string. How do I make it just list the strings?
推荐答案
您真的很需要那有无字符串属性对象的列表。随着.NET 3.5,你可以欺骗:
You really need a list of objects that have a string property. With .NET 3.5 you could cheat:
.DataSource = list.Select(x=>new {Value = x}).ToList();
否则,创建一个虚拟的类和手动复制数据...
Otherwise create a dummy class and copy the data in manually...
相关推荐
最新文章