c# - Serialization by DataContract -


what attributes must used next class (and/or class members):

[datacontract(namespace = "classnamespace")] public class testclass {      [datamember(name = "fieldname1")]     public string field1;      [datamember(name = "fieldname2")]     public string field2;      [datamember(name = "fieldname3")]     public enumtype filed3;  } 

what class serialize next xml:

<testclass xmlns:a="classnamespace" xmlns:i="http://www.w3.org/2001/xmlschema-instance" fieldname1="fieldvalue1" fieldname2="filedvalue2" fieldname3="fieldvalue3" /> 

but not to:

<testclass xmlns:a="classnamespace" xmlns:i="http://www.w3.org/2001/xmlschema-instance"><a:fieldname1>fieldvalue1</a:fieldname1><a:fieldname2>fieldvalue2</a:fieldname2><a:fieldname3>fieldvalue3</a:fieldname3></testclass> 


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -