Recursive reading of List<Object>

前端 未结 5 1712
滥情空心
滥情空心 2020-12-17 07:18

I have this structure of List, to be specific it is a \"CategoryItem\" Object. Here\'s my declaration of \"CategoryItem\" Object.

         


        
      
      
      
5条回答
  •  囚心锁ツ
    2020-12-17 08:11

    Maybe take a look at the TreeView control? http://msdn.microsoft.com/en-us/library/7a9swst5(v=vs.80).aspx

    The ASP.NET TreeView control is designed to present users with data in a hierarchical structure. Users can open individual nodes that can in turn contain child nodes. The TreeView control is suitable for displaying XML data, but can be used for any data that can be represented in a hierarchy.

    I think it will be what you want.

    Otherwise, it's a matter of iterating through each item in your list and recursively processing each sub-item which may or may not have more sub-items. It's tricky, but only at first.

提交回复
热议问题