Exemple #1
0
        private static void WriteCustomMethodsExamples()
        {
            Console.WriteLine("Examples of custom methods.");

            CustomString str = CustomString.CreateInstance("HeLLo wOrld".ToCharArray());

            Console.WriteLine($"{nameof(str)} = CreateInstance(\"{str}\")");

            Console.WriteLine($"str.RemoveByPredicate(c => char.IsUpper(c)) => {str.RemoveByPredicate(c => char.IsUpper(c))}");
            Console.WriteLine($"str.RemoveByPredicate(c => c == 'L') => {str.RemoveByPredicate(c => c == 'L')}");
            Console.WriteLine($"str.ReplaceByDelegate(c => char.ToLower(c)) => {str.ReplaceByDelegate(c => char.ToLower(c))}");
            Console.WriteLine($"str.ReplaceByDelegate(c => char.ToLower(c) == 'l' ? '1' : c)) => {str.ReplaceByDelegate(c => char.ToLower(c) == 'l' ? '1' : c)}");

            WriteSeparatorStringsAndAwaitMessage();
        }