using System; public class IndexersTest { public static void Main(string[] args) { // create a box IndexerBox box = new IndexerBox(30, 30, 30); // show dimensions with numeric indexers Console.WriteLine("Created a box with the dimensions:"); Console.WriteLine("box[ 0 ] = {0}", box[0]); Console.WriteLine("box[ 1 ] = {0}", box[1]); Console.WriteLine("box[ 2 ] = {0}", box[2]); // set a dimension with the numeric indexer Console.WriteLine("\nSetting box[ 0 ] to 10...\n"); box[0] = 10; // set a dimension with the string indexer Console.WriteLine("Setting box[ \"width\" ] to 20...\n"); box["width"] = 20; // show dimensions with string indexers Console.WriteLine("Now the box has the dimensions:"); Console.WriteLine("box[ \"length\" ] = {0}", box["length"]); Console.WriteLine("box[ \"width\" ] = {0}", box["width"]); Console.WriteLine("box[ \"height\" ] = {0}", box["height"]); } // end Main } // end class BoxTest