Esempio n. 1
0
        static void DelegatesMath()
        {
            OverMath math    = new OverMath();
            MathInt  mathInt = math.Plus;

            Console.WriteLine(n1 + " + " + n2 + " = " + mathInt(n1, n2));
            mathInt = math.Minus;
            Console.WriteLine(n1 + " - " + n2 + " = " + mathInt(n1, n2));
            mathInt = math.Gange;
            Console.WriteLine(n1 + " * " + n2 + " = " + mathInt(n1, n2));
            mathInt = math.Dividere;
            Console.WriteLine(n1 + " / " + n2 + " = " + mathInt(n1, n2));
            mathInt = math.Potens;
            Console.WriteLine(n1 + "^" + n2 + " = " + mathInt(n1, n2));
            MathFloat mathFloat = math.Plus;

            Console.WriteLine(n3 + " + " + n4 + " = " + mathFloat(n3, n4));
            mathFloat = math.Minus;
            Console.WriteLine(n3 + " - " + n4 + " = " + mathFloat(n3, n4));
            mathFloat = math.Gange;
            Console.WriteLine(n3 + " * " + n4 + " = " + mathFloat(n3, n4));
            mathFloat = math.Dividere;
            Console.WriteLine(n3 + " / " + n4 + " = " + mathFloat(n3, n4));
            mathFloat = math.Potens;
            Console.WriteLine(n3 + "^" + n4 + " = " + mathFloat(n3, n4));
            MathString mathString = math.Plus;

            Console.WriteLine(n5 + " + " + n6 + " = " + mathString(n5, n6));
            mathString = math.Minus;
            Console.WriteLine(n5 + " - " + n6 + " = " + mathString(n5, n6));
            mathString = math.Gange;
            Console.WriteLine(n5 + " * " + n6 + " = " + mathString(n5, n6));
            mathString = math.Dividere;
            Console.WriteLine(n5 + " / " + n6 + " = " + mathString(n5, n6));
            mathString = math.Potens;
            Console.WriteLine(n5 + "^" + n6 + " = " + mathString(n5, n6));
            Math1Int    math1Int    = math.Kvadratrod;
            Math1Float  math1Float  = math.Kvadratrod;
            Math1String math1String = math.Kvadratrod;

            Console.WriteLine("Kvadratroden af 64 = " + math1Int((int)64));
            Console.WriteLine("Kvadratroden af 9 = " + math1Float((float)9));
            Console.WriteLine("Kvadratroden af 625 = " + math1String("625"));
        }
Esempio n. 2
0
 public List(string title, string[] values, Action <int> updateIndex, Func <int> currentIndex) : base(title)
 {
     _updateDisplayValue = () => {
         _isOnNextEnabled = currentIndex() < values.Length - 1 && values.Length > 1;
         _isOnPrevEnabled = currentIndex() > 0 && values.Length > 1;
         _displayValue    = values[currentIndex()];
     };
     SelectNext = () => {
         if (IsOnNextEnabled)
         {
             var value = MathInt.Clamp(currentIndex() + 1, 0, values.Length - 1);
             updateIndex(value);
         }
     };
     SelectPrev = () => {
         if (_isOnPrevEnabled)
         {
             var value = MathInt.Clamp(currentIndex() - 1, 0, values.Length - 1);
             updateIndex(value);
         }
     };
 }
Esempio n. 3
0
    static void Main(string[] args)
    {
        //string name = "   [  Prabdeeddeep  = ]   ";
        //string replaceString = "eep";
        //string withString = "[replaced]";
        //string contains = "   [  P";
        //string startsWith = "   [  P";
        //string endsWith = "= ]   ";
        int[] ary = { 3, 5, 6, 7, 10, 4, 2, 7 };

        //Console.WriteLine("Trim(): [" + StringFunctions.Trim(name) + "]");
        //Console.WriteLine("TrimStart(): [" + StringFunctions.TrimStart(name) + "]");
        //Console.WriteLine("TrimEnd(): [" + StringFunctions.TrimEnd(name) + "]");
        //Console.WriteLine("Replace(): [" + StringFunctions.Replace(name, replaceString, withString) + "]" + " Answer: [" + name.Replace(replaceString, withString) + "]");
        //Console.WriteLine("All Caps: " + StringFunctions.ToUpper(name));
        //Console.WriteLine("All Small: " + StringFunctions.ToLower(name));
        //Console.WriteLine("Contains(): " + contains + " is " + StringFunctions.Contains(name, contains));
        //Console.WriteLine("StartsWith(): " + startsWith + " is " + StringFunctions.StartsWith(name, startsWith));
        //Console.WriteLine("EndsWith(): " + endsWith + " is " + StringFunctions.EndsWith(name, endsWith));
        Console.WriteLine(MathInt.GetMinValue(ary));
        Console.WriteLine(MathInt.GetMaxValue(ary));
    }