Esempio n. 1
0
        static void Main(string[] args)
        {
            MyStruct <double> list = new MyStruct <double>();

            list.Add(1.0);
            list.Add(4.5);
            list.Add(-76.6338);
            list.Add(-7);
            list.Add(0.000000000000001);
            foreach (var item in list)
            {
                Console.WriteLine(item);
            }
            list.RemoveAllElementsAfterTheMax();
            list.Show();
            Console.WriteLine(list.Average());
            Console.WriteLine(list.SmallerThanAverageCount());
            Console.ReadKey();
        }
Esempio n. 2
0
        public static void TestSequence()
        {
            MyStruct x1 = new MyStruct(1.0);
            MyStruct x2 = MyStruct.Add(x1, new MyStruct(2.0));

            Assert.AreEqual(1, x1.Value);
            Assert.AreEqual(3, x2.Value);

            MyStruct y1 = new MyStruct(1.0);
            MyStruct y2 = y1 + new MyStruct(2.0);

            Assert.AreEqual(1, y1.Value);
            Assert.AreEqual(3, y2.Value);
        }