static void Main1(string[] args) { StringDataStore strStore = new StringDataStore { [0] = "One", [1] = "Two", [2] = "Three", [3] = "Four" }; Console.WriteLine(strStore["one"]); Console.WriteLine(strStore["two"]); Console.WriteLine(strStore["Three"]); Console.WriteLine(strStore["Four"]); strStore["one"] = "A"; // because on string indexer "set" }
static void Main(string[] args) { StringDataStore strStore = new StringDataStore(); strStore[0] = "One"; strStore[1] = "Two"; strStore[2] = "Three"; strStore[3] = "Four"; Console.WriteLine(strStore["one"]); Console.WriteLine(strStore["two"]); Console.WriteLine(strStore["Three"]); Console.WriteLine(strStore["FOUR"]); }
static void Main(string[] args) { StringDataStore strStore = new StringDataStore(); strStore[0] = "One"; strStore[1] = "Two"; strStore[2] = "Three"; strStore[3] = "Four"; for (int i = 0; i < 10; i++) { Console.WriteLine(strStore[i]); } }
public void Test() { var dataStore = new StringDataStore(); dataStore.SetString(0, "1"); dataStore.SetString(1, "two"); dataStore.SetString(2, "III"); dataStore[3] = "4"; dataStore[4] = "five"; dataStore[5] = "IV"; var index = dataStore["five"]; dataStore[index] = "5"; for (int i = 0; i < 10; i++) { Console.WriteLine(dataStore[i]); } }
public void Test() { var stringDataStore = new StringDataStore(); stringDataStore.SetString(0, "1"); stringDataStore.SetString(1, "two"); stringDataStore.SetString(2, "III"); stringDataStore[3] = "4"; stringDataStore[4] = "five"; stringDataStore[5] = "VI"; var fiveIndex = stringDataStore["five"]; stringDataStore[fiveIndex] = "FIVE"; for (int i = 0; i < 10; i++) { Console.WriteLine(stringDataStore[i]); } }