ThingWorx Edge .NET SDK Reference > .NET SDK: VirtualThing Class
.NET SDK: VirtualThing Class
The VirtualThing class represents your device/machine in the client application. It corresponds to and binds with a Thing (created with a RemoteThing Thing Template) that exists in a ThingWorx Platform. The VirtualThing class provides the foundation for defining the properties, services, and events that are accessible from the platform.
Properties, services, and events can be defined using attributes. If attributes are used in the VirtualThing, you must call the initializeFromAnnotations() method in the constructor of the VirtualThing.
The scan rate specifies how often to request updates from the device. The processSScanRequestmethod of the VirtualThing class uses the scan rate when it runs. The SteamSensorClient.cs example gets the scan rate from the property values entered in the SteamSensor Console, as shown here:
int scanRate = Int32.Parse(args[2]);
In SteamSensorClient.cs, the scan rate is set before creating the Virtual Things (client) for the application. When creating the Steam Sensor client, the configuration set up in the ClientConfigurator passed in, as shown here:

SteamSensorClient client = new SteamSensorClient(config);
SteamSensorClient.cs defines two VirtualThings, whose Thing names are SteamSensor1 and SteamSensor2:

// Create two Virtual Things
SteamThing sensor1 = new SteamThing("SteamSensor1", "1st Floor Steam Sensor", null, client);
SteamThing sensor2 = new SteamThing("SteamSensor2", "2nd Floor Steam Sensor", "SN0002", client);
The rest of this section describes the methods of the VirtualThing class that you can use to define properties, services, and events. It also describes the methods of this class that you can use to modify values of properties and optional methods that can be overridden in classes derived from the VirtualThing class. For details, refer to :
Was this helpful?