delphi、C++、C# 数据类型对应
byte:1个字节。
int/Integer:
long:
long long:8字节,64位
shortInt:2字节,16位
LongInt:4字节,32位
Int64:8字节,64位
word:
float:4字节
double:8字节
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Delphi_to_C%2B%2B_types_mapping
Delphi | C++ | C# | 字节Byte | 位数Bit | |
double | double | 8 | 32 | ||
single | float | 4 | 16 | ||
integer | int | 4 | 16 | ||
int64 | long | 8 | 32 | ||
short | |||||
word | |||||
Dword | |||||
ansichar | char | char | -128-127 | ||
byte | unsigned char | 0~255 | |||
PByte array[0..254] of Byte; |
unsigned char* 或者 PBYTE |
ref byte | |||
|
|||||
TBytes; TArray<Byte> |
BYTE * |
函数参数 ref byte byte[] |
|||
LongInt DWORD |
unsigned long DWORD |
uint |
|||
DWORD & |
ref uint |
||||
var int | int * |
ref int |
|||
IntPtr | HANDLE |
IntPtr |
|||
array [0 .. $40] of AnsiChar; |
StringBuilder |
||||
SmallInt | short | ||||
PAnsiChar | char* | ||||
Word | unsigned int | ||||
unsigned int* | |||||
LPVOID | |||||
Word | unsigned short | 0..65535 | |||
Pointer | VOID* | ||||
VARIANT |
VARIANT System::Variant |
||||
VARIANT* | ref object | ||||
OleVariant | System::OleVariant | ||||
WideString | BSTR | string | |||
TBytes | byte[] | ||||
TArray<Integer> 或 s:array[1..5] of integer 或 TIArr = array of integer |
int[] |
http://www.cnblogs.com/del/archive/2007/12/03/981563.html
delphi与C#语法转换
C#功能
byte[] CopyToBig(byte[] bBig, byte[] bSmall) { List<byte> lTemp = new List<byte>(); lTemp.AddRange(bBig); lTemp.AddRange(bSmall); bBig = new byte[lTemp.Count]; lTemp.CopyTo(bBig); return bBig; }
delphi实现
var
aint:integer;
调用函数fun(int *);
fun(&aint);
var TagType:Word
function fun1( x: Integer): Integer;
function fun(var x: Integer): Integer;
function fun2(const x: Integer): Integer;