The MIL_ID and MIL_INT data types have been included in the MIL.NET wrapper, and so are usable when writing C# or Visual Basic code. Other data types require a language-specific equivalent. The MIL_ID and MIL_INT data types implement the IComparable and the IConvertible interfaces. Please refer to the .NET framework's documentation for more information on these interfaces.
The MIL_INT type is a structure provided to enable writing portable code for 32-bit and 64-bit applications. The MIL_INT type implements explicit conversion operators for the basic .NET types. This allows you to perform basic arithmetic and logical operations between a MIL_INT and any other numeric type, such as a long, double, or byte.
Note that in a 32-bit operating system, MIL_INT behaves like an int, and in a 64-bit operating system, it behaves like a long.
The following chart explains the data type equivalents between MIL custom types, .NET types, Visual C# types, and Visual Basic types. When writing MIL code in C# or Visual Basic, replace the MIL custom data type with the language specific equivalent data type in the chart. Note that MIL_ID and MIL_INT do not require an equivalent and can be used directly in C# and Visual Basic code. Also note that the .NET type can be used in any .NET language, including C# and Visual Basic.
There are no .NET equivalents for the MIL_TEXT macro and the M_PTR_TO_DOUBLE() macro, and so the macros' parameter (a string inside quotation marks) can be used directly when setting the function's parameters, without any reference to the macro itself. An example can be found in the MIL with.NET example section later in this chapter.
MIL Custom Type |
.NET type |
Visual C# type |
Visual Basic type |
MIL_ID |
MIL_ID 1 |
MIL_ID 1 |
MIL_ID 1 |
MIL_INT |
MIL_INT 1 |
MIL_INT 1 |
MIL_INT 1 |
MIL_UINT (32-bit) |
System.UInt32 |
uint |
N/A 2 |
MIL_UINT (64-bit) |
System.UInt64 |
ulong |
N/A 2 |
MIL_DOUBLE |
System.Double |
double |
Double |
MIL_INT8 |
System.SByte |
sbyte |
N/A 2 |
MIL_UINT8 |
System.Byte |
byte |
Byte |
MIL_INT16 |
System.Int16 |
short |
Short |
MIL_UINT16 |
System.UInt16 |
ushort |
N/A 2 |
MIL_INT32 |
System.Int32 |
int |
Integer |
MIL_UINT32 |
System.UInt32 |
uint |
N/A 2 |
MIL_INT64 |
System.Int64 |
long |
Long |
MIL_UINT64 |
System.UInt64 |
ulong |
N/A 2 |
MIL_TEXT_PTR |
System.String |
string |
String |
MIL_FLOAT |
System.Single |
float |
Single |
MIL_BUFFER_INFO |
System.IntPtr |
System.IntPtr |
System.IntPtr |
MIL_FPGA_CONTEXT |
System.IntPtr |
System.IntPtr |
System.IntPtr |
1 This data type can be used in this language only with the MIL.NET wrapper.
2 Visual Basic does not have an equivalent data type, but you can use the equivalent .NET data type when writing Visual Basic code.