c# - Creating a class from nested unstructured data -


is there way create class kind of data?

<condition>     <action/>     <action/>     <condition>         <action/>         <action/>         <condition>             <condition>                 <action/>             </condition>         </condition>     </condition> </condition> 

the data above intrepreted <condition> condition object , <action> action object.

the scenario hierarchy till 1 .. n depth, , n number of nested condition n number of actions inside.

this not xml way wanted show how data nested

then define 2 properties:

class condition {     public condition condition {get; set;} // different name?     public list<action> actions {get; set;}  } 

how know action under condition

you can enumerate nested structure find or add parent information each action:

class action {     public condition parent { get; }     public action(condition parent)     {         parent = parent;         parent.actions.add(this); // not sure if idea     } } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -