public void SetConfiguration(DisplayControllerSettings configuration) { if (configuration is ParallelDisplayControllerSettings pcfg) { this.SetConfiguration(pcfg); } else { throw new ArgumentException("Must pass an instance whose type matches the interface type."); } }
public void SetConfiguration(DisplayControllerSettings configuration) { switch (this.Interface) { case DisplayInterface.Parallel when configuration is ParallelDisplayControllerSettings pcfg: this.SetConfiguration(pcfg); break; case DisplayInterface.Spi when configuration is SpiDisplayControllerSettings scfg: this.SetConfiguration(scfg); break; case DisplayInterface.I2c when configuration is I2cDisplayControllerSettings icfg: this.SetConfiguration(icfg); break; default: throw new ArgumentException("Must pass an instance whose type matches the interface type."); } }
void IDisplayControllerProvider.SetConfiguration(DisplayControllerSettings configuration) { }