I want to be able to associate everything in my program with the original integer that it is found as, but in the end, I want to be able to output a specific string based on that integer number. Right now all of the integers that are found by my program are added to a list, so I was wondering if there was a way that I could use a foreach() loop for each item T in that list and then add a corresponding string to another list.
Is there a way I can do this with Enums or any other build in functions in c#? Ideally, I would want something that looks like this:
public enum Tools
{
tool1 = 1001,
tool2,
tool3,
tool4
}
foreach (int T in ToolList)
{
//I want to get the enum value based on which int value is passed.
strToolList.add((int).Tools);
}
I think I would then be able to later convert the tool names to strings for output with a separate function, but if anyone knows how to do that while accomplishing this as well, that would be useful.
Thanks in advance!