.NET / C# Binding IList to a DataGridView

前端 未结 2 1699
悲&欢浪女
悲&欢浪女 2021-01-12 08:40

I have an IList returning from a function (as variable lst) and I set and then I

this.dataGridView1.DataSource = lst;
         


        
2条回答
  •  一个人的身影
    2021-01-12 09:26

    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...

提交回复
热议问题