コード例 #1
0
        static void Main(string[] args)
        {
            double min1, max1;

            SuperList.MinMax2      MM2Struct;
            Tuple <double, double> MM3Tuple;

            SuperList lst = new SuperList()
            {
                12.3, 1.0, 0.4, 16, 92
            };

            lst.GetMinMax1(out min1, out max1);

            Console.WriteLine($"Min1: {min1}\nMax1: {max1}");

            // 2nd GetMinMax
            MM2Struct = lst.GetMinMax2();

            Console.WriteLine($"Min2: {MM2Struct.Min}\n" +
                              $"Max2: {MM2Struct.Max}");

            // 3rd GetMinMax
            MM3Tuple = lst.GetMinMax3();

            Console.WriteLine($"Min3: {MM3Tuple.Item1}\n" +
                              $"Max3: {MM3Tuple.Item2}");
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SuperList sl = new SuperList()
            {
                4, -5, 10, -11, 40, 14, 51, 0
            };

            double min, max;

            SuperList.MinMax       minMax;
            Tuple <double, double> refTuple;

            (double min, double max)valTuple;

            sl.GetMinMax1(out min, out max);
            Console.WriteLine($"v1: min = {min}, max = {max}");

            minMax = sl.GetMinMax2();
            Console.WriteLine($"v2: min = {minMax.Min}, max = {minMax.Max}");

            refTuple = sl.GetMinMax3();
            Console.WriteLine($"v3: min = {refTuple.Item1}, max = {refTuple.Item2}");

            valTuple = sl.GetMinMax4();
            Console.WriteLine($"v4: min = {valTuple.min}, max = {valTuple.max}");
        }
コード例 #3
0
        static void Main(string[] args)
        {
            SuperList myList = new SuperList()
            {
                10.5, -1.5, 2.3, 40.9, 0.0
            };
            double min, max;

            myList.GetMinMax1(out min, out max);
            Console.WriteLine($"Min = {min} | Max = {max}");

            SuperList.MinMax mm = myList.GetMinMax2();
            Console.WriteLine($"Min = {mm.Min} | Max = {mm.Max}");

            Tuple <double, double> tp = myList.GetMinMax3();

            Console.WriteLine($"Min = {tp.Item1} | Max = {tp.Item2}");

            (double min, double max)valTp = myList.GetMinMax4();
            Console.WriteLine($"Min = {valTp.min} | Max = {valTp.max}");
        }