public void Cook(Potato potato) { if (this.CheckPotato(potato)) { // perform some potatocooking logic potato.IsCooked = true; } }
private bool CheckPotato(Potato potato) { if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { return true; } return false; } return false; }
private bool CheckPotato(Potato potato) { if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { return(true); } return(false); } return(false); }
static void Main(string[] args) { Potato potato = GetPotato(); if (potato != null) { if (potato.HasBeenPeeled && !potato.IsRotten) { Cook(potato); } } else { throw new Exception("Potato should not be null!"); } }
public static void Main(string[] args) { var potato = new Potato(); var chef = new Chef(); try { var meal = CookingIf.ProcessVegetable(potato, chef); Console.WriteLine(meal); } catch (ArgumentException e) { Console.WriteLine(e.Message); } MatrixIf.VisitCell(5, 5); }
private static void Cook(Potato potato) { throw new System.NotImplementedException(); }