日期:2011-03-13  浏览次数:20479 次

I don't know about you, but I'm very fond of the ListView control - it's a very useful control to have around. Microsoft's .NET Framework provides much of the functionality you need to display data in a ListView. However, you're still left will some work to do. Loading the ListView and getting the data can be an arduous task. In fact, your code can get pretty messy unless you think things through a bit. In order to display complex class data, you should consider a way to associate your class data with each ListItem in the ListView.
For example, consider the following class, which represents data you might want to relate to a particular ListView control:
class Person                                                                               
   {                                                                                       
   public string Name;                                                                     
   public string Rank;                                                                     
   public string SerialNumber;                                                             
                                                                                           
   public Person (string n, string r, string sn)                                           
    &nbs