Ad
Reflection
Metaprogramming
Programming Paradigms
Advanced Language Features
Fundamentals
Code
Diff
  • using System;
    using System.Reflection;
    using System.Linq;
    
    class Kata
    {
      
      private static readonly string LANGUAGE = "C#";
      
      public static void Main()
      {
        Console.WriteLine($"Hello, {LANGUAGE}!");
      }
      
    }
    • using System;
    • 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()}!");
    • Console.WriteLine($"Hello, {LANGUAGE}!");
    • }
    • }
Code
Diff
  • class Kata
    {
      public static void Main()
      {
        string language = "C#";
        System.Console.WriteLine($"Hello, {language}!");
      }
    }
    • class Kata{
    • public static void Main(){
    • class Kata
    • {
    • public static void Main()
    • {
    • string language = "C#";
    • System.Console.WriteLine("Hello, {0}!",language);
    • System.Console.WriteLine($"Hello, {language}!");
    • }
    • }
Fundamentals
Code
Diff
  • using System;
    
    public class Kata
        {
            public  static int Opposite(int number) => number*(-1);
        }
    • using System;
    • public class Kata
    • {
    • public static int Opposite(int number) => ~number + 1;
    • public static int Opposite(int number) => number*(-1);
    • }