c# - Serialize Dotnet Collection without Root Element? -


consider following serialized xml:

<course>   <title>engineering</title>   <student>     <name>john doe</name>   </student>   <student>     <name>jane doe</name>   </student>    ... </course> 

unfortunately not in position modify schema. (ideally should have wrapped student class students root element!)

how define entity classes serialization work properly?

i tried following code, generates xml students wrapper element.

public class course {     public string title { get; set; }     public list<student> students { get; set; } }  public class student {     public string name { get; set; } } 

add xmlelement attribute students list, this:

public class course {     public string title { get; set; }      [xmlelement("student")]     public list<student> students { get; set; } } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -