public void ApplySwitchsignal(bool turnOn) { if (turnOn) { _switchableDevice.TurnOn(); } else { _switchableDevice.TurnOff(); } }
public void Toggle() { IsSwitchOn = !IsSwitchOn; if (IsSwitchOn) { device.TurnOn(); } else { device.TurnOff(); } }
public void Switch(ISwitchable device) { if (device.IsOn) { device.TurnOff(); } else { device.TurnOn(); } device.IsOn = !device.IsOn; }
public void Toggle() { isOn = !isOn; if (isOn) { switchable.TurnOn(); } else { switchable.TurnOff(); } }
static void Main(string[] args) { MessWithOnOff <Light> messer = new MessWithOnOff <Light>(); messer.Flip(new Light()); List <Person> group = new List <Person> { new Person { Name = "Bob", Age = 50 }, new Person { Name = "Tom", Age = 30 } }; group.Sort(); //int[] arr = { 1, 2, 3, 4, 5 }; //test(ref arr[3]); //Console.WriteLine(arr[3]); //IEnumerable<string> names = new string[] { "John", "Bob", "Tom" }; Light a = new Light(); ISwitchable b = a; I38Faucet c = a; //a.TurnOn(); b.TurnOn(); c.TurnOn(); IEnumerable <ISwitchable> switchPanel = new List <ISwitchable> { new Light(), new Light() }; switchPanel = new List <Light> { new Light(), new Light() }; Console.ReadLine(); }
public void Toggle() { swhithable.TurnOff(); swhithable.TurnOn(); }