c# - Is it legal XML to have two different List objects using some sort of level identifier to separate and identify them? -



c# - Is it legal XML to have two different List<> objects using some sort of level identifier to separate and identify them? -

i thinking using xml file hold multiple types of data. let’s illustration have 2 lists. see plenty of examples serializes single list xml root, haven’t found right keywords find examples of embedding two.

i’d see c# code decodes such structure.

as illustration lists might have classes following.

public class item { public string name; public int count; public bool active; public override string tostring() { homecoming string.format("{0,-10} {1,10} {2:true,2:false}", name, count, active); } } public class item2 { public string name; public string category; public int length; public int height; public override string tostring() { homecoming name; } }

create new class , set both of lists within class:

public class allthethings { public list<item> items; public list<item2> items2; }

then serialize class. note can many levels deep want. instance item have list within of well.

c# xml .net-4.0

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -