Click to See Complete Forum and Search --> : a problem - a little confused


bixel
August 28th, 2008, 12:29 AM
1st I created a struct (class)


namespace RolePlayingGameData
{
/// </summary>
[Serializable]
public struct SpellList
{
//Main guts
[ContentSerializer(Optional = true)]
public bool MySpell1;
[ContentSerializer(Optional = true)]
public bool MySpell2;
}
}
there is actually a whole bunch more there but I left it out for space reasons

all of those booleans get written to a xml file, with a true or false setting. But I've drank too much coffee and I forgot how to properly use the for each arguement

how do I return a updated SpellList with only the Spells marked true in the list??

nabeelisnabeel
August 28th, 2008, 03:18 AM
Do you want something like this...?


SpellList[] list = new SpellList[10];
ArrayList results = new ArrayList();
//populated here
foreach(SpellList listItem in list)
{
if(listItem.MySpell1 == true && listItem.MySpell2 == true)
results.Add(listItem);
}

//do whatever u wish with results here

bixel
August 28th, 2008, 04:15 PM
Ahh awesome you know I was just thinking that in my head last night (I guess sleeping on it really works!!!) but I didn't know the correct syntax. Ah thanks for pointing that out.