I have a system of toggles in my program. A user can define a toggle to contain accepted and unaccepted tags. I was trying to think of an efficient way to store those. So far the best I came up with is a three dimensional array, so I could do:
toggles[0,0,0] = "allowedtag1";
toggles[0,0,1] = "allowedtag2";
toggles[0,1,0] = "badtag1";
toggles[0,1,1] = "badtag2";
What would be the best way to store that, or is that really the way to go? Thanks :)
Best way to store these data?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Mahesh ChandRank #1 · 393.4K reputationPosted Jan 30, 2011, 4:48 PM EST
You can simply create a Structure with four boolean properties and one of them is true at one time. Setting one true sets false the rest.
narasimman g146 reputationPosted Jan 30, 2011, 10:02 PM EST
String ToggleSrtring = value1.tostring +","+Value2.tostring()+","+Value3.tosting(); //string wil be "0,0,0"
store all possible contents in Hashtable like
HashTable hshToggle = new HashTable()
hsgToggle.Add("0,0,0", "AllowedTag1");
When you retreive use the below coding
string Result = hshToggle[ToggleSrtring].ToString();
Sam HobbsRank #108 · 20.5K reputationPosted Jan 31, 2011, 6:45 PM EST