// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; namespace E { public class GoodWay { private static Dictionary numbers; static GoodWay() { numbers = new Dictionary(); numbers.Add("number_1", "This is number 1"); numbers.Add("number_2", "This is number 2"); } public static void Main(string[] args) { int iResult = 1; string newVar = "number_" + iResult; string val = numbers[newVar]; Console.WriteLine(val); } } }