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 :)
Loading
Sam HobbsPosted Jan 31, 2011, 11:45 PM
narasimman gPosted Jan 31, 2011, 3:02 AM
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();
Mahesh ChandPosted Jan 30, 2011, 9:48 PM
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.