private void EnsureSensor(bool throwIfNotSet) { if(Sensor == null) { if(throwIfNotSet) throw new InvalidOperationException("Sensor isn't set to a valid value."); else return; } }