ThingWorx Edge .NET SDK > ThingWorx Edge .NET SDK Reference > .NET SDK: VirtualThing Class > .NET SDK: PropertyDefinition Class
.NET SDK: PropertyDefinition Class
Property definitions describe properties that are available to the ThingWorx platform. To create a property definition, you must call the defineProperty method of the base VirtualThing class.
There are two defineProperty methods, one that takes a PropertyDefinition, and one that takes the essential parameters of a PropertyDefinition:
defineProperty(PropertyDefinition propertyDefinition)
defineProperty(String name, String description, BaseTypes baseType,
AspectCollection aspects)
Properties of the PropertyDefinition Class
The following parameters are available on the PropertyDefinition class:
name — The name of the property. This name appears in ThingWorx Composer when a user browses the Properties page for the remote thing.
baseType — The type of the property.
description — A description of the property, which can give further context to the property.
aspects — Aspects further define the ways to interact with properties, and include the following:
dataChangeType — The data change type describes how the ThingWorx platform responds when the value in the VirtualThing changes. Subscriptions to these value changes can be modeled in ThingWorx Composer. If nothing needs to react to the property change, it is recommended that this value is set to NEVER. Valid values include:
Always notify of the value change even if the same value comes in multiple times in a row.
Only notify when the value changes.
For BOOLEAN types, only when the value is true.
For BOOLEAN types only when the value is false.
The ThingWorx platform does nothing based on the value change.
dataChangeThreshold — Defines how much the value must change in order to trigger a change event. For example 0 (zero) indicates that any change will trigger an event. A value of 10 (ten) for example would not trigger an update unless the value changed by an amount greater or equal to 10.
defaultvalue — The default value is the value that the ThingWorx platform uses when the remote thing connected to the VirtualThing first starts up and has not received an update from the VirtualThing. The value is different based on the different value for each base type.
isPersistent — Set to true to have the ThingWorx platform persist the value even when the platform restarts. It is extremely expensive to have persistent values, so it is recommended to set this value to false, unless it is absolutely necessary to have them.
isReadOnly — Set to true to inform the ThingWorx platform that this value can only be read, not written.
cacheTime — The amount of time that a value remains in the cache before it is considered “old”. Note that this aspect works in conjunction with the pushType aspect and can have the following values:
A value of -1 informs the ThingWorx platform that the remote application always sends the value of the property, and that the platform does not need to request it from the client application.
A value of 0 (zero) indicates that every time the ThingWorx platform needs the value, it should request it from the client application.
Any other positive value indicates that the ThingWorx platform caches the value for that many seconds, and only after that time expires, requests the value from the client application.
It is recommended to set this value to -1 if the client application will be setting the value every time it changes.
pushType — Informs the ThingWorx platform how the VirtualThing will push its values to it. The possible values are as follows:
Push Type
Updates are sent, even if the value has not changed.
The value is never sent. The ThingWorx platform must request the value when it needs it.
Updates are sent only when the value changes.
Example 16. Property Definition in the .NET SDK
The example below does the following:
Defines a basic PropertyDefinition.
Defines a collection of aspects that are added to the PropertyDefinition.
Adds the PropertyDefinition to the VirtualThing.
//Create the property definition with name, description, and baseType
PropertyDefinition property1 = new PropertyDefinition(
"Description for Property1",

//Create an aspect collection to hold all of the different aspects
AspectCollection aspects = new AspectCollection();

//Add the dataChangeType aspect
new StringPrimitive(;

//Add the dataChangeThreshold aspect
aspects.Add(Aspects.ASPECT_DATACHANGETHRESHOLD, new NumberPrimitive(0.0));

//Add the cacheTime aspect
aspects.Add(Aspects.ASPECT_CACHETIME, new IntegerPrimitive(0));

//Add the isPersistent aspect
aspects.Add(Aspects.ASPECT_ISPERSISTENT, new BooleanPrimitive(false));

//Add the isReadOnly aspect
aspects.Add(Aspects.ASPECT_ISREADONLY, new BooleanPrimitive(false));

//Add the pushType aspect
aspects.Add("pushType", new StringPrimitive(;

//Add the defaultValue aspect
aspects.Add(Aspects.ASPECT_DEFAULTVALUE, new BooleanPrimitive(true));

//Set the aspects of the property definition

//Add the property definition to the Virtual Thing