-
Notifications
You must be signed in to change notification settings - Fork 10
list_get_module
Vladimir edited this page Feb 14, 2020
·
1 revision
RelaysEnumerator en = new RelaysEnumerator();
IEnumerable<RelayInfo> relaysInfo = en.CollectDevices();
string id = "BRDID";
RelayInfo relayInfo = relaysInfo.FirstOrDefault(x => x.Id == id);
if (relayInfo != null) {
Relay relay = new Relay(relayInfo);
if (relay != null) {
...
}
}
or
RelaysEnumerator en = new RelaysEnumerator();
IEnumerable<RelayInfo> relaysInfo = en.CollectDevices();
string id = "BRDID";
Relay relayInfo = relaysInfo
.Where(x => x.Id = id)
.Select(x => new Relay(x))
.FirstOrDefault();
if (relay != null) {
...
}