Click here to Skip to main content
14,827,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have string array (string[])
which has some values like

ad23g4

ad25

ad1g5

string[] newsval=new string[] {"ad23g4","ad25","ad1g5"}

string[] testother=new string[]{""};

and i have xml where

ad23g4 ="true"
ad25="false"
ad1g5="true"


now from above

i check if( status=="true"){

add newsval[1] into testother[1]
add newsval[3] into testother[3]

}

i dont want to add newsval[2] as it is false

how to do this in asp.net

regards
maulik shah
Posted
Comments
Karthik_Mahalingam 13-Mar-14 0:45am
   
post your code to read the xml

1 solution

Read the xml and store it in a dictionary with key value as string(key) and
boolean(value)
Filter the dictionary for only true values and get the count
Initialise an array as
C#
int count=0; // get from dictionary
        string[] testother = new string[count];

and iterate the dictionary to match the string in the array
and assign the values to the new array..
   

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