|
-
August 28th, 2008, 12:29 AM
#1
a problem - a little confused
1st I created a struct (class)
Code:
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??
-
August 28th, 2008, 03:18 AM
#2
Re: a problem - a little confused
Do you want something like this...?
Code:
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
-
August 28th, 2008, 04:15 PM
#3
Re: a problem - a little confused
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|