public void MyStuff()
        {
            var things = new BoxOfThings <string>();

            things[0] = "bread";
            things[1] = "milk";
            things[2] = "Shampo";

            Assert.Equal("milk", things[1]);

            var favoriteNumbers = new BoxOfThings <int>();

            favoriteNumbers[0] = 9;
            favoriteNumbers[1] = 20;

            var answer = favoriteNumbers[0] + favoriteNumbers[1];
        }
        public void MyStuff()
        {
            var things = new BoxOfThings <string>();

            things[0] = "Bread";
            things[1] = "Milk";

            Assert.Equal("Milk", things[1]);

            var favoriteNumbers = new BoxOfThings <int>();

            favoriteNumbers[0] = 21;
            favoriteNumbers[1] = 9;
            var answer = favoriteNumbers[0] + favoriteNumbers[1];

            Assert.Equal(30, answer);
        }
Ejemplo n.º 3
0
        public void MyStuff()
        {
            // Data type here is a string (from our T)
            var things = new BoxOfThings <string>();

            things[0] = "Bread";
            things[1] = "Milk";
            things[2] = "Shampoo";
            // etc. etc.

            Assert.Equal("Milk", things[1]);

            // Data type here is an int (from our T)
            var favoriteNumbers = new BoxOfThings <int>();

            favoriteNumbers[0] = 9;
            favoriteNumbers[1] = 20;
            var answer = favoriteNumbers[0] + favoriteNumbers[1];

            Assert.Equal(29, answer);
        }