Esempio n. 1
0
        private static void Oefening3()
        {
            string         prev = "";
            CreateMessage1 cm   = delegate(string current)
            {
                if (prev == "")
                {
                    prev = current;
                    return("");
                }
                bool   currentLarger = prev.Length > current.Length;
                string result        = $"{prev} contains more characters than {current}: {currentLarger}";
                prev = current;
                return(result);
            };

            GetFruit().ForEach(word =>
            {
                string message = cm.Invoke(word);
                if (!string.IsNullOrEmpty(message))
                {
                    Console.WriteLine(message);
                }
            });
        }
Esempio n. 2
0
        private static void Oefening2()
        {
            CreateMessage1 cm = delegate(string word)
            {
                return($"{word} telt {word.Length} tekens");
            };

            GetFruit().ForEach(word => Console.WriteLine(cm.Invoke(word)));
        }
Esempio n. 3
0
        private static void Oefening1()
        {
            CreateMessage1 cm = delegate(string word)
            {
                return(word.ToUpper());
            };

            GetFruit().ForEach(word => Console.WriteLine(cm.Invoke(word)));
        }
Esempio n. 4
0
        private static void Oefening4()
        {
            CreateMessage1 cm = delegate(string word)
            {
                char[] charArr = word.ToCharArray();
                Array.Sort(charArr);
                return($"Characters of {word} alphabetically : \"{String.Join("", charArr)}\"");
            };

            GetFruit().ForEach(word => Console.WriteLine(cm.Invoke(word)));
        }