Пример #1
0
        static void Main(string[] args)
        {
            /* Input: head = 1 -> 5 ->4 ->2 -> NULL, valueToCheck = 2.  Result: true
            *  Input: Head = 1 -> 5 ->4 ->2 -> NULL, valueToCheck = 3.  Result: false*/
            Node noid            = new Node();
            bool checktwo        = noid.IsValueInList(2, noid);
            bool checkthree      = noid.IsValueInList(3, noid);
            bool checktwoagain   = noid.CheckAgain(2, noid);
            bool checkthreeagain = noid.CheckAgain(3, noid);
            bool nullcheck       = noid.CheckAgain(null, noid);
            bool lazynull        = noid.IsValueInList(null, noid);

            //bool extratwo = noid.ExtraCheck(2, noid);
            // bool extrathree = noid.ExtraCheck(3, noid);

            //Check with .Conains method
            Console.WriteLine("Lazy mode");
            Console.WriteLine(checktwo);
            Console.WriteLine(checkthree);

            //write our own method with properties
            Console.WriteLine("Not as Lazy Mode");
            Console.WriteLine(checktwoagain);
            Console.WriteLine(checkthreeagain);

            Console.WriteLine("Check for Null Values");
            Console.WriteLine(lazynull);
            Console.WriteLine(nullcheck);


            Console.WriteLine("Extra Check");
            Console.WriteLine(noid.Next);
            //  Console.WriteLine(extratwo);
            //  Console.WriteLine(extrathree);
        }