Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class Sensor
  2. {
  3. public SensorType SensorType { get; set; }
  4. public int RegisterAddress { get; set; }
  5. public int BitNumber { get; set; }
  6. public int Position { get; set; }
  7. public int Value { get; set; }
  8. }
  9.  
  10. foreach (var sensor in sensors.Where(s => s.SensorType == selectedType))
  11. sensor.Value = newValue;
  12.  
  13. var list = new List<int>();
  14. for (int i = 0; i < list.Count; i++)
  15. {
  16. if (someCondition)
  17. list[i] = newValue;
  18. }
  19.  
  20. sensors=sensors.Select(x=>
  21. {
  22. x.Value=x.SensorType==selectedType?newValue:x.value;
  23. return x;
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement