C# using string as part of int
Posted on 2010-09-16
Can you help with the following:
I need to have a int that has a string as part of the name.
and want to assign a value to int XYZ100 by a string so that when
the string = XYZ, it will know to use int XYZ100.
This is for streaming data so it needs to be fast and not looking for simple if statement,
I'm currenly using If statements but need to expand to more than 200 different int and think there is faster way then if statements (hardcoded).
I'm not sure if Dictionary is the fastest?
I would like someone to show how to do the above by using just string and the int.
Reflection has been suggested but as a slower solution.
Any suggestions and examples greatly appreciated.