Golfing this kata by renaming number to n, changing method-body to an expression bodied member to eliminate returns, using value tuples in a switch expression, using string interpolation instead of ToString and the last and in my opinion the most controversial golfing step: eliminating unnecessary whitespace.
Removing the unnecessary whitespace makes this hard to read. So, adding whitespace would make this much nicer to read/understand. Ignoring formatting issues that may be a matter of personal taste, I present a formatted version:
public class FizzBuzz
{
public string GetOutput(int n)
=>
(n % 3, n % 5) switch
{
(0, 0) => "FizzBuzz",
(0, _) => "Fizz",
(_, 0) => "Buzz",
_ => $"{n}"
};
}
public class FizzBuzz{public string GetOutput(int n)=>(n%3,n%5)switch{(0,0)=>"FizzBuzz",(0,_)=>"Fizz",(_,0)=>"Buzz",_=>$"{n}"};}
public class FizzBuzz {public string GetOutput(int number){if (number%3==0&&number%5==0){return"FizzBuzz";}if(number%3==0){return "Fizz";}if(number%5==0){return "Buzz";}return number.ToString();}}- public class FizzBuzz{public string GetOutput(int n)=>(n%3,n%5)switch{(0,0)=>"FizzBuzz",(0,_)=>"Fizz",(_,0)=>"Buzz",_=>$"{n}"};}