Ad
Reflection
Metaprogramming
Programming Paradigms
Advanced Language Features
Fundamentals

Just for the sake of showing a different way, of course its way more bloated and uses more resources and imports...

Code
Diff
  • using System.Reflection;
    using System.Linq;
    
    class Kata
    {
      
      private static readonly string LANGUAGE = "C#";
      
      public static void Main()
      {
        System.Console.WriteLine($"Hello, {typeof(Kata).GetRuntimeFields().First(x => x.Name == "LANGUAGE").GetValue(null).ToString()}!");
      }
      
    }
    • using System.Reflection;
    • using System.Linq;
    • class Kata
    • {
    • private static readonly string LANGUAGE = "C#";
    • public static void Main()
    • {
    • System.Console.WriteLine($"Hello, {LANGUAGE}!");
    • System.Console.WriteLine($"Hello, {typeof(Kata).GetRuntimeFields().First(x => x.Name == "LANGUAGE").GetValue(null).ToString()}!");
    • }
    • }