ThingWorx Edge .NET SDK > Installing and Navigating the Directories of the ThingWorx Edge .NET SDK > Additional .NET SDK Example
Additional .NET SDK Example
The following examples are provided to outline common, but more complex, operations that can be performed with the .NET SDK. These examples are for demonstration purposes only.
Property/Service with INFOTABLE Base Type
The following example illustrates how to create a property and service that use a base type of INFOTABLE. The infotable contains an ID (base type INTEGER) and a Value (base type STRING):
The property is defined as an infotable, using annotations.
The service takes an infotable as a parameter and returns the same infotable.
// Class Annotations for the property

description="String Index Property",
aspects = new string [] {

// This needs to be in the constructor or a method called from the
// constructor.
// First a data shape definition needs to be added to the VirtualThing

FieldDefinitionCollection fields = new FieldDefinitionCollection();

// Define the fields
fields.addFieldDefinition(new FieldDefinition("ID", BaseTypes.INTEGER));
fields.addFieldDefinition(new FieldDefinition("Value", BaseTypes.STRING));

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

// Service Definition
[method: ThingworxServiceDefinition(
description = "Returns the passed in String Map",
aspects=new string[]{"dataShape:StringMap"})]
[return: ThingworxServiceResult(
aspects = new string[] { "dataShape:StringMap" })]
public InfoTable StringMapService(
aspects=new string[]{
"dataShape:StringMap"})] InfoTable value )
return value;