ThingWorx Edge .NET SDK > ThingWorx Edge .NET SDK Reference > .NET SDK: DataShapeDefinition Class
  
.NET SDK: DataShapeDefinition Class
Use the DataShapeDefinition class to model the metadata of the ThingWorx platform data shapes. You define data shapes in the VirtualThing. A DataShapeDefinition is required for each infotable and event data that your client application uses. The only mechanism for defining a data shape is in code.
.NET SDK Data Shapes: Infotables
INFOTABLE is the aggregate base type within the ThingWorx platform environment. An infotable requires a DataShapeDefinition that describes the names, base types, and additional information about each field within the table. Data within an infotable is contained in rows. Each row can have one or more fields, described by the DataShapeDefinition that describes the names, base types, and additional information about each field within the infotable.
Once the infotable has been created, data is added to the table, one row at a time. When a row is created, data must be added to the row in the same order that it is defined in the data shape. If data is not added in the correct order, the infotable forms incorrectly. No warning is generated when this issue occurs, and the problem becomes evident only when a user tries to view the data from a mashup or in ThingWorx Composer.
You use an infotable to hold results of a service, data for an event, or the values returned by a read request for multiple properties. The table can contain one or more rows. When results are returned in an infotable, you need to extract the values from each row, using the methods, getFirstRow(), getSecondRow(), and so on. You also use a helper function that matches the base type for the field, such as getStringValue().
.NET SDK Data Shapes: FieldDefinition Class
A DataShapeDefinition consists of a collection of field definitions. Each FieldDefinition class represents a field in a data shape. The following parameters are available on the FieldDefinition class:
baseType — The base type that the field represents. For example: STRING or INTEGER.
description — A description of the field.
name — The name of the field.
The example below defines a collection of fields and the fields for the FieldDefinition in the same order as they appear in the DataShapeDefinition. It then passes the collection of fields to the DataShapeDefinition:
// Create a collection to hold the field definitions
FieldDefinitionCollection fields = new FieldDefinitionCollection();

// Define the fields
fields.addFieldDefinition(new FieldDefinition("Field1", BaseTypes.STRING));
fields.addFieldDefinition(new FieldDefinition("Field2", BaseTypes.NUMBER));
fields.addFieldDefinition(new FieldDefinition("Field3", BaseTypes.INTEGER));

// Add the DataShapeDefinition to the VirtualThing
this.defineDataShapeDefinition("MyDataShape", fields);