using System; class Kata { public static string Main(string greeting, string language) => $"{greeting} {language}!".Tee(Console.WriteLine); } public static class Extensions { public static T Tee<T>(this T @this, Action<T> action) { action(@this); return(@this); } }
- using System;
- class Kata {
public static string Main(string greeting, string language) {Console.WriteLine(Greeting(greeting, language));return Greeting(greeting, language);}public static string Greeting(string greeting, string language) => $"{greeting} {language}!";- public static string Main(string greeting, string language)
- => $"{greeting} {language}!".Tee(Console.WriteLine);
- }
- public static class Extensions
- {
- public static T Tee<T>(this T @this, Action<T> action)
- {
- action(@this);
- return(@this);
- }
- }