Data Types

Remoting SDK supports a variety of data types that are available when designing your service interface in Service Builder. Because Remoting SDK supports different platforms, it uses common names to refer to these data types - which might not necessarily be the same as those used by your language of choice.

The page provides a brief introduction to the data types available and it explains what underlying .NET or Delphi types are used by Remoting SDK.

Type Description
Binary The Binary type is used to pass unstructured binary data between tiers in your application.

For .NET, Remoting SDK uses a custom class that descends from MemoryStream to represent this binary data.

For Delphi, a similar custom class (TROBinaryMemoryStream) is used.
Boolean Used to send Boolean values of true or false. On .NET,this uses the System.Boolean type (bool in C#).
Currency The Currency type is used to pass fixed-point decimal numbers between the tiers of your application.

For .NET, this maps to the System.Decimal type, but note that the streaming format for BinMessage uses a different binary representation for this type, equal to the OleAutomation and Delphi "Currency" type, which is basically a 64 bit integer shifted so that the 4 least significant digits represent decimals.

For Delphi, this maps to the language's "currency" type, which is a 64-bit fixed-point numerical type with 4 significant decimal points.
DateTime System.DateTime
Double System.Double
Int64 64-bit signed integer type. System.Int64 (long in C#) for .NET, Int64 for Delphi.
Integer 32-bit signed integer type. System.Int32 (int in C#) for .NET, Integer for Delphi.
String The "String" data type is used to represent strings of characters.

While on the .NET platform all strings map to System.String, the "String" data type will be serialized as 8-bit ANSI string (and might be represented as such on other platforms). The system's current ANSI code page will be used for encoding, so the actual encoding will be dependent on the system locale.
If you need to send strings while preserving the full 16 bit Unicode character set, define your services to use the WideString or Utf8String types discussed below. In general, Utf8String will be the best option for strings when using .NET on one or both sides of the communication.

In Delphi, this type maps directly to the 8-bit "string" language type.
Utf8String The Utf8String data type is used to represent strings of characters. As a compromise between the plain "String" data type and WideStrings, Utf8Strings will be serialized as UTF-8 encoded 8 bit strings preserving any Unicode characters, while maintaining a smaller memory footprint than WideStrings.

In .NET, Utf8Strings will atomatically be converted back and forth to the 16-bit System.String type; application code will notice no different between using WideString and Utf8String.

In Delphi, the String and Utf8Strings data types will be handled identically, and mapped to the "string" language type. It is up to the application's code to treat received strings as UTF-8 encoded and use the RTL functions to convert them back from and to ANSI or WideString, where needed.
Variant The variant type can be used to represent a field or parameter of unknown type and can hold different types of data at runtime.

For .NET, variants are represented as System.Object and support any of the following .NET data types: Binary — Boolean — Byte — DateTime — Decimal — Double — Int32 — Int64 — String — arrays of any of the above, including nested arrays
Passing any other type of object into or out of a service method (whether as a parameter or nested inside a struct) will cause an InvalidVariantValueException at runtime.

For Delphi, this maps directly to the languages "Variant" type.
WideString The WideString data type is used to represent strings of characters. In contrast to the "String" data type, WideStrings will be serialized as true 16 bit strings, preserving any Unicode characters. As a downside, they will consume twice as much space (in the uncompressed message) as normal String types.
Arrays Arrays can be defined in the Service Builder library in order to pass arrays of any other valid type between the tiers of your application.

For .NET, arrays will be represented as standard system arrays (System.Array) just as if you defined them in code. the Service Builder only supports single-dimension arrays, although you can use "array of array of" nesting to create non-rectangular arrays.

In Delphi, custom class types are generated in the Intf unit to represent array types.
Structs Structs are used in Service Builder to define record like groups of fields, much like a regular C# "struct" or Pascal "record".
Structs are implemented as custom classes descending from the ComplexType and code for them will be created in the auto-generated _Intf file of your library.
Structs can contain any number of elements of all the types described here (including Arrays and other Structs).