共用方式為


Data Types

Glossary Item Box

VPL Reference: VPL MenusUtilities Overview

See Also Microsoft Robotics Developer Studio Send feedback on this topic

Data Types

The Microsoft Visual Programming Language supports .NET C# style data types.

VPL Type Description
bool Boolean values: true, false
byte 8 bit unsigned integer (0 to 255)
sbyte 8 bit signed integer (-128 to 127)
char character
decimal fixed point decimal number (fixed precision number)
double double precision (64-bit) floating point number (approx 14 significant digits)
float single precision (32-bit) floating point number (approx 7 significant digits)
int 32 bit signed integer
uint 32 bit unsigned integer
long 64 bit signed integer
ulong 64 bit unsigned integer
short 16 bit signed integer (-32768 to 32767)
ushort 16 bit unsigned integer (0 to 65535)
string character string (text)

VPL supports Lists but not Arrays. However, a List can often be used instead of an Array. (An array is a set of variables that are all of the same data type and are accessed via a single variable name and an index. They are usually of fixed length. Lists are more general-purpose and allow you to insert and delete elements anywhere in the list.)

VPL has limited support for arbitrary user-defined data types. The simple data structures used in operation messages can generally be used in expressions using "dot notation" to select the members of a class. VPL usually creates a variable called value to hold the response from an activity. If this value is a compound data type (referred to as a class or a structure) then you can access its elements (called members or properties). In the the following example a string property called FullName can be obtained from a message:

value.FullName

To convert from one data type to another, you can use C# cast operations. For example, to convert from an integer called myInt to a string, use this expression:
(string) myInt

Sometimes casts fail because the data cannot be represented using the new data type. For example, if the string called FullName contains "abc" and is cast to an integer using

(int) FullName

it will not work because the string does not contain the text equivalent of a number. However, if it contained "123" the cast would succeed.

See Also 

VPL Reference: VPL MenusUtilities Overview

 

 

© 2012 Microsoft Corporation. All Rights Reserved.