private void BadExample(BaseFootballer footballer) { string salary = string.Empty; if (footballer is Amator) { salary = $"Footballer type: {footballer.GetType().Name}, Salary: {10.ToString("C", CultureInfo.GetCultureInfo("pl-PL"))}"; } if (footballer is Star) { salary = $"Footballer type: {footballer.GetType().Name} Salary: {1_000_000.ToString("C", CultureInfo.GetCultureInfo("pl-PL"))}"; } Console.WriteLine(salary); }
public void Notify(BaseFootballer footballer, string rumor) { if (footballer is RumorFootballer && rumor.Contains("wife")) { _aggresiveFootballer.ReactOnRumor(rumor); return; } else if (footballer is RumorFootballer) { _aggresiveFootballer.ReactOnRumor(rumor); _captain.ReactOnRumor(rumor); return; } else { _captain.ReactOnRumor(rumor); _rumorFootballer.ReactOnRumor(rumor); return; } }