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
Post a Comment