public static Device ToDevice(this DeviceName deviceName, Device[] devices) { string realDeviceName = deviceName.ToRealName(); return(devices.Single(x => x.Name == realDeviceName)); }