public IPeripheralsGroup GetOrCreate(string name) { IPeripheralsGroup result; if (!TryGetByName(name, out result)) { result = new PeripheralsGroup(name, machine); groups.Add((PeripheralsGroup)result); } return(result); }
public IPeripheralsGroup GetOrCreate(string name, IEnumerable <IPeripheral> peripherals) { IPeripheralsGroup existingResult = null; var result = (PeripheralsGroup)existingResult; if (!TryGetByName(name, out existingResult)) { result = new PeripheralsGroup(name, machine); groups.Add(result); } foreach (var p in peripherals) { result.Add(p); } return(result); }