Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C# - 如何将 Hashtable 添加到 Listview?我有一个返回 Hashtable 的函数,我希望能够将 Hashtable 的内容添加到 Listview。
由于缺乏信息,非常通用,但大致如下:
foreach (var item in hashtable.Values) { listView.Items.Add(new ListViewItem(item.ToString())); }
您可以按照您想要的方式提供ListView's DisplayMemberas KeyofHashtable和ValueMemberas Value ofHashTable或反之亦然。
ListView's
DisplayMember
Key
Hashtable
ValueMember
HashTable