Analysis of nested list data in C #

I am developing a C # application in visual studio 2010. In this application, I get some data in the following format. I need to analyze the data from it.

Data format:

List, item 3(upto n..) data1 List, item 3(upto n..) (as data2) data1 data2 List, item 3(upto n..) (as data3) data1 data2 data3 data3 

I can use a multidimensional (notched) array, List <>, Dictionary, etc. for this. But
Question:

What is the best and optimized way to parse above formatted data? What type of data should I use?

Any help or suggestions are welcome.

Thanks in advance...

+4
source share
1 answer

I would use a custom data structure as the code below. An interface is not required strictly speaking, but it makes your data structure a little more flexible if you need to start processing more complex packages.

EDIT: Internal packages must be a collection

 public interface IPacket { String Data { get;set; } IList<IPacket> InnerPackets {get;set;} } public class Packet : IPacket { public String Data { get;set; } public IList<IPacket> InnerPackets {get;set;} } 
0
source

Source: https://habr.com/ru/post/1484148/


All Articles