A repository of exercises to support the training.
Your smart home system is expanding, and now you need to generate data, partition it into manageable sections, and project only relevant information to the user interface.
You’ve been asked to simulate a large batch of sensor data for testing purposes. Use LINQ to generate test data that represents a series of sensor readings over time.
Instructions:
SensorID
, Temperature
, and Humidity
.public class SensorReading
{
public int SensorID { get; set; }
public double Temperature { get; set; }
public double Humidity { get; set; }
}
You need to display devices in pages on a dashboard, with each page showing 10 devices at a time. Use LINQ to partition the device list into pages.
Instructions:
Your system only needs to display a subset of information about each device on the dashboard, such as DeviceID
and Status
. Use LINQ projection to create a new collection with only the necessary fields.
Instructions:
DeviceID
and Status
from the list.Happy exploring and I'll see you in the next Module!