Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my question is :


foreach (XmlNode node in DOC.SelectNodes("/AppBuilderProject/AppBuilderForms/AppBuilderForm/Title"))
{
project.forms = node.innertext;
}

it generate error:

cannot implicity convert type string to system.collection.arraylist
Posted

I think the project.forms variable is an array and hence the error.

you will have to give index for example,
C#
int i;
foreach (XmlNode node in DOC.SelectNodes("/AppBuilderProject/AppBuilderForms/AppBuilderForm/Title"))
 {
 project.forms[i] = node.innertext;
i++;
 }


Hope that helps
Milind
 
Share this answer
 
C#
foreach (XmlNodeList nodelist in DOC.SelectNodes("/AppBuilderProject/AppBuilderForms/AppBuilderForm/Title"))
{
    foreach(XmlNode node in nodelist)
    {
      project.forms = node.innertext;
    }
}
 
Share this answer
 
Comments
Hamza chaudhary 7-Nov-12 4:13am    
same error !
saud_a_k 7-Nov-12 4:23am    
If its just XML you want to read use XPathNavigator
sse this: http://www.codeproject.com/Articles/52079/Using-XPathNavigator-in-C

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900