c# - XML Serialization Customized Partially -


in brief need custom class project partially

public class project : ixmlserializable {     [xmlattribute]     public string name;     [xmlignore]     public string[] contents;     public xmlschema getschema()     {         return null;     }    public void readxml(xmlreader reader)   {       if (reader.hasattributes)       {           contents=new string[reader.attributecount];           (int = 0; < reader.attributecount; i++)           {               reader.movetoattribute(i);               string attr = reader.name;               regex reg = new regex(@"content_\d+");               if (reg.ismatch(attr))               {                   contents[i] = reader.value;               }           }       }   }    public void writexml(xmlwriter writer)   {       (int = 0; < contents.count(); i++)       {           writer.writeattributestring("content_" + i, contents[i]);       }   } } 

i want name serialized custom contents of array (i need make attribute in project node ). happen when implement project class name kept null idea how can this?

in readxml method never assign name property. add

name= "somevalue"; 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -