Using an enum in this case is trying to fit a square peg in a round hole. Whereas XML is overkill for what you're trying to do.
Use a dictionary instead. That way, there is a direct 'key => value' relationship and the value can be anything.
For the 1-1 string string relationship use this:
Dictionary<string, string> dictA = new Dictionary<string, string>();
dictA.Add("string1", "value1");
dictA.Add("string2", "value2");
dictA.Add("string3", "value3");
To access all of the values of the dictionary use this:
foreach (KeyValuePair<string, string> item in dictA)
{
Console.WriteLine("Key: {0}; Value: {1};", item.Key, item.Value);
}
If you need a 1-2 1-3 or 1-n string relationship use this:
Dictionary<string, List<string>> dictB = new Dictionary<string, List<string>>();
dictB.Add("string1", new List<string>() {"value1A", "value1B"});
dictB.Add("string2", new List<string>() {"value2A", "value2B"});
dictB.Add("string3", new List<string>() {"value3A", "value3B"});
To access all of the values of the dictionary use this:
foreach (KeyValuePair<string, List<string>> item in dictB)
{
Console.WriteLine("Key: {0}; Values: {1}, {2};", item.Key, item.Value[0], item.Value[1]);
}
If you need a staggered array relationship use this:
Dictionary<string, List<string>> dictB = new Dictionary<string, List<string>>();
dictB.Add("string1", new List<string>() {"value1A", "value1B, value1C"});
dictB.Add("string2", new List<string>() {"value2A", "value2B, value2C, value2D"});
dictB.Add("string3", new List<string>() {"value3A", "value3B"});
To access all of the values of the dictionary use this:
foreach (KeyValuePair<string, List<string>> item in dictB)
{
string values = "";
int valLen = ((List<string>)item.Value).Count;
for (int i = 0; i < valLen; i++)
{
if (i == (valLen - 1))
{
values += item.Value[i] + "";
}
else
{
values += item.Value[i] + ", ";
}
}
Console.WriteLine("Key: {0}; Values: {1};", item.Key, values);
}
To get the value for a specific key do something like this:
string match = "string2";
if (dictD.ContainsKey(match))
{
Console.WriteLine("The value for Key='{0}' is: '{1}'", match, dictD[match]);
}
An Enums is nothing but a glorified Dictionary. That's why you won't see them in a lot of other languages (especially dynamically typed languages).