public Drive(IHardware hardware) { Hardware = hardware; Initialize(); foreach (PropertyInfo prop in this.GetType().GetProperties()) { if (prop.PropertyType == typeof(ISensor)) { prop.SetValue(this, SensorTool.NAIfNull((ISensor)prop.GetValue(this))); } } }
public CPU(IHardware cpu) { Hardware = cpu; Cores = new Dictionary <int, Core>(); Initialize(); foreach (PropertyInfo prop in this.GetType().GetProperties()) { if (prop.PropertyType == typeof(ISensor)) { prop.SetValue(this, SensorTool.NAIfNull((ISensor)prop.GetValue(this))); } } }
public Motherboard(IHardware hardware) { Hardware = hardware; foreach (PropertyInfo prop in this.GetType().GetProperties()) { if (prop.PropertyType == typeof(List <ISensor>)) { prop.SetValue(this, new List <ISensor>()); } } Initialize(); foreach (PropertyInfo prop in this.GetType().GetProperties()) { if (prop.PropertyType == typeof(ISensor)) { prop.SetValue(this, SensorTool.NAIfNull((ISensor)prop.GetValue(this))); } } }