c# - Convert single XElement to object -


i have single xelement looking this:

<row flag="1" sect="" header="" body="" extrainfo="0" /> 

then have class looking this:

public class productattribute {     public string flag { get; set; }     public string sect { get; set; }     public string header { get; set; }     public string body { get; set; }     public string extrainfo { get; set; } } 

how can convert xelement productattribute object?

you have put correct serialization attributes on class , class members

[serializable()] [xmlroot(elementname = "row")] public class productattribute {     [xmlattribute("flag")]     public string flag { get; set; }     [xmlattribute("sect")]     public string sect { get; set; }     [xmlattribute("header")]     public string header { get; set; }     [xmlattribute("body")]     public string body { get; set; }     [xmlattribute("extrainfo")]     public string extrainfo { get; set; } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -