列表框和列表< string>联系 [英] List Box and List<string> Connection

查看:59
本文介绍了列表框和列表< string>联系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中遇到问题.

I have problem in C#.

我有一个列表框和一个名为FileManager的类. FileManager包含一个称为ValidateFile的方法,该方法需要将验证和有效文件添加到FileManager类的列表中.

I have a list box and a class called FileManager. FileManager contains, a method called ValidateFile which validate and valid files need to add to a list in the FileManager class.

我想将列表的内容添加到我的列表框中.我只是遍历该列表并将其添加到我的列表框中.

I want to add contents of list to my list box. And I am just running through the list and adding to my listbox.

由于FileManager类中的ValidateFile花费了更多时间,并且为了保持UI处于活动状态,我在Delegate上调用ValidateFile方法.

Since, ValidateFile in FileManager Class takes little more time and to keep my UI live, I am calling ValidateFile method on a Delegate.

但是,我正在寻找FileManager.List更改或列表中的任何更改应反映在我的列表框中时填充我的列表框的好方法.

But I am searching for good way to populate my listbox when FileManager.List changes or for any change in the list should reflect in my listbox.

请根据需要提供邮政编码或网络链接.

please post code or web links if you have.

谢谢你, 沙沙

推荐答案

我相信您对ObservableCollection<T>类感兴趣,请参见

I believe you're interested in the ObservableCollection<T> class, see MSDN.

这篇关于列表框和列表&lt; string&gt;联系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆