C# Little library with DataGrid control
I need to create a little library that has the DataGrid control as frontend.
In fact this library will have just 2 columns: Filename;FileProperty
The filenames will be scanned again on each application start,开发者_开发百科 the FileProperty column will be filled at runtime (if my application did an action the file) and should then be also be shown. Futhermore i also need a filtering possiblity by the Filename column. Sorting by both columns should also be possible.
There will be around 10.000 datarows in the library. Persisiting / saveing data to the harddisk is not needed => everything should happen in RAM.
How to do this in easiest / best / fastest way? Which structure (DataSet, DataTable, ..) gives best performance?
The DataGrid does not need a DataSet/Table. In your case the best would be to create a DataGrid and set VirtualMode = true and handle the events from CellValueNeeded. Then you can have alle the filenames in a SortedDictionary. Use a FileSystemWatcher to update the grid with changes.
精彩评论