== Convert Delphi to C# == == Delphi vs. C# Data Types ==
Delphi DataType | C# datatype |
---|---|
ansistring | string |
boolean | bool |
byte | byte |
char | char |
comp | double |
currency | decimal |
double | double |
extended | double |
int64 | long |
int32 | int |
int16 | short |
integer | int |
longint | int |
longword | uint |
olevariant | object |
pchar | string |
real | double |
real48 | double |
shortint | sbyte |
single | float |
smallint | short |
string | string |
variant | object |
widechar | string |
widestring | string |
word | ushort |
textfile | System.IO.FileInfo |
tdate | System.DateTime |
tdatetime | System.DateTime |
tfiletime | System.DateTime |
hresult | long |
pointer | object |
ansichar | char |
file | System.IO.File |
plongint | int |
pinteger | int |
pcardinal | uint |
pword | double |
pdword | double |
psmallint | short |
pbyte | byte |
pshortint | short |
pint64 | long |
plongword | uint |
psingle | float |
pdouble | double |
pdate | System.DateTime |
pdispatch | object |
ppdispatch | object |
perror | object |
pwordbool | bool |
punknown | object |
ppunknown | object |
ppwidechar | string |
ppchar | string |
ppansichar | string |
pansichar | string |
pextended | double |
pcomp | double |
pcurrency | double |
pvariant | object |
polevariant | object |
ppointer | object |
pboolean | bool |
pdatetime | System.DateTime |
thandle | long |
tresult | long |
cardinal | uint |
tbytearray | byte[] |
twordarray | int[] |
dword | int |
pstring | string |
pwidestring | string |
tsystemtime | System.DateTime |
bytebool | bool |
longbool | bool |
wordbool | bool |
hmodule | long |
tlargeinteger | int |
plargeinteger | int |
pwidechar | string |
toleenum | long |
pbytearray | byte[] |
pwordarray | int[] |
pansistring | string |
ptextbuf | string |
shortstring | string |
utf8string | string |
text | System.IO.Stream |
textfile | System.IO.Stream |
textinput | System.IO.TextReader |
textoutput | System.IO.TextWriter |
ttypeinfo | System.Type |
tbytes | sbyte[] |
Delphi | C# |
---|---|
* | * |
/ | / |
\ | / |
Mod | % |
Div | \ |
+ | + |
- | - |
< | < |
<= | <= |
> | > |
>= | >= |
<> | != |
= | == |
Not | ! |
Xor | ^ |
Shl | << |
Shr | >> |
Or | || |
And | && |
In | (UNSUPPORT) |
As | type cast |
Is | is |
@ | (UNSUPPORT) |
^(pointer) | (UNSUPPORT) |
Delphi | C# | Supported |
---|---|---|
library/package/unit/program | class | Yes |
uses | using | Yes |
interface/dispinterface | interface | Yes |
initialization | public void initialization() | Yes |
finalization | public void finalization() | Yes |
const | const | Yes |
resourcestring res = string | const string res = string | Yes |
type | Yes | |
array of | [] | Yes |
record ... end | struct | Yes |
set ... of | enums | Yes |
File ... of | System.IO.File | Yes |
procedure/function | method | Yes |
constructor/destructor | constructor/method | Yes |
object ... end | class | Yes |
public/protected/private/published | public | Yes |
class of ... | object | Yes |
class ... end | class | Yes |
overload/virtual/dynamic/message/export/deprecated | Yes | |
property | class's property | Yes |
:= | = | Yes |
do while for repeat | do while for | Yes |
if ... then ... else ... | if ... else ... | Yes |
case ... of ... | switch ... | Yes |
with | Yes | |
try ... except ... finally | try ... catch... | Yes |
Raise | throw | Yes |
asm ... end | No | |
requires | No | |
contains | No | |
exports | No | |
resident | No | |
inline | No | |
inherited | No | |
case ... of | No | |
function/procedure IDENTIFIER = IDENTIFIER; | No | |
Conditional Compiler Statement($IFDEF $ELSE $ENDIF}) | #if #else #endif | No |
Delphi | C# | Supported |
---|---|---|
abort | new Exception | Yes |
addexitproc | No | |
addterminateproc | No | |
adjustlinebreaks | No | |
allocmem | No | |
ansicomparefilename | String.CompareTo | Yes |
ansicomparestr | String.CompareTo | Yes |
ansicomparetext | String.CompareTo | Yes |
ansidequotedstr | No | |
ansiextractquotedstr | No | |
ansilastchar | No | |
ansilowercase | String.ToLower | Yes |
ansilowercasefilename | String.ToLower | Yes |
ansipos | String.IndexOf | Yes |
ansiquotedstr | No | |
ansisamestr | String.Equls | Yes |
ansisametext | String.Equls | Yes |
ansistrcomp | String.CompareTo | Yes |
ansistricomp | String.CompareTo | Yes |
ansistrlastchar | No | |
ansistrlcomp | String.CompareTo | Yes |
ansistrlicomp | String.CompareTo | Yes |
ansistrlower | String.ToLower | Yes |
ansistrpos | String.IndexOf | Yes |
ansistrrscan | String.LastIndexOf | Yes |
ansistrscan | String.IndexOf | Yes |
ansistrupper | String.ToUpper | Yes |
ansiuppercase | String.ToUpper | Yes |
ansiuppercasefilename | String.ToUpper | Yes |
appendstr | += | Yes |
assignstr | = | Yes |
beep | No | |
booltostr | No | |
bytetocharindex | Yes | |
bytetocharlen | No | |
bytetype | No | |
callterminateprocs | No | |
changefileext | No | |
charlength | No | |
chartobyteindex | No | |
chartobytelen | No | |
comparemem | No | |
comparestr | String.CompareTo | Yes |
comparetext | String.CompareTo | Yes |
createdir | Directory.CreateDirectory | Yes |
createguid | No | |
currentyear | DateTime.Today.Year | Yes |
currtostr | No | |
currtostrf | No | |
date | DateTime.Today | Yes |
datedelta | 693594 | Yes |
datetimetofiledate | No | |
datetimetostr | Yes | |
datetimetostring | Yes | |
datetimetosystemtime | Yes | |
datetimetotimestamp | Yes | |
datetostr | Yes | |
dayofweek | DateTime.DayOfWeek | Yes |
decodedate | No | |
decodedatefully | No | |
decodetime | No | |
deletefile | File.Delete | Yes |
directoryexists | Directory.Exists | Yes |
diskfree | No | |
disksize | No | |
disposestr | No | |
dllproc | No | |
encodedate | No | |
encodetime | No | |
exceptionerrormessage | No | |
excludetrailingbackslash | Path.GetDirectoryName | Yes |
excludetrailingpathdelimiter | Path.GetDirectoryName | Yes |
expandfilename | Path.GetFullPath | Yes |
expandfilenamecase | Path.GetFullPath | Yes |
expanduncfilename | No | |
extractfiledir | Path.GetDirectoryName | Yes |
extractfiledrive | Path.GetPathRoot | Yes |
extractfileext | Path.GetExtension | Yes |
extractfilename | Path.GetFileName | Yes |
extractfilepath | Path.GetDirectoryName | Yes |
extractrelativepath | No | |
extractshortpathname | No | |
falseboolstrs | No | |
fileage | No | |
fileclose | File.Close | Yes |
filecreate | File.Create | Yes |
filedatetodatetime | No | |
fileexists | File.Exists | Yes |
filegetattr | File.GetAttributes | Yes |
filegetdate | File.GetCreationTime | Yes |
fileisreadonly | Yes | |
fileopen | File.Open | Yes |
fileread | No | |
filesearch | No | |
fileseek | No | |
filesetattr | File.SetAttributes | Yes |
filesetdate | No | |
filesetreadonly | No | |
filewrite | No | |
finalizepackage | No | |
findclose | No | |
findcmdlineswitch | No | |
findfirst | No | |
findnext | No | |
floattocurr | Convert.ToDecimal | Yes |
floattodatetime | Convert.ToDateTime | Yes |
floattodecimal | Convert.ToDecimal | Yes |
floattostr | Convert.ToString | Yes |
floattostrf | Convert.ToString | Yes |
floattotext | Convert.ToString | Yes |
floattotextfmt | No | |
fmtloadstr | No | |
fmtstr | No | |
forcedirectories | Directory.CreateDirectory | Yes |
format | No | |
formatbuf | No | |
formatcurr | No | |
formatdatetime | No | |
formatfloat | No | |
freeandnil | No | |
getcurrentdir | Environment.CurrentDirectory | Yes |
getenvironmentvariable | Environment.GetEnvironmentVariable | Yes |
getfileversion | No | |
getformatsettings | No | |
getlocaleformatsettings | No | |
getmodulename | No | |
getpackagedescription | No | |
getpackageinfo | No | |
gettime | DateTime.Now | Yes |
guidtostring | No | |
hinstance | No | |
incamonth | DateTime.AddMonths | Yes |
includetrailingbackslash | No | |
includetrailingpathdelimiter | No | |
incmonth | DateTime.AddMonths | No |
initializepackage | No | |
interlockeddecrement | No | |
interlockedexchange | No | |
interlockedexchangeadd | No | |
interlockedincrement | No | |
inttohex | Int32.ToString("x") | Yes |
inttostr | Inr32.toString | Yes |
isdelimiter | No | |
isequalguid | No | |
isleapyear | DateTime.IsLeapYear | Yes |
ispathdelimiter | No | |
isvalidident | No | |
languages | No | |
lastdelimiter | No | |
leadbytes | No | |
loadpackage | No | |
loadstr | No | |
lowercase | String.ToLower | Yes |
msecstotimestamp | No | |
newstr | No | |
nextcharindex | No | |
now | DateTime.Now | Yes |
nullstr | No | |
outofmemoryerror | No | |
quotedstr | No | |
raiselastoserror | No | |
raiselastwin32error | No | |
removedir | Directory.Delete | Yes |
renamefile | File.Move | Yes |
replacedate | No | |
replacetime | No | |
safeloadlibrary | No | |
samefilename | String.Equals | Yes |
sametext | String.Equals | Yes |
setcurrentdir | Environment.CurrentDirectory = value | Yes |
showexception | No | |
sleep | Thread.CurrentThread.Sleep | Yes |
stralloc | No | |
strbufsize | String.Length | Yes |
strbytetype | No | |
strcat | + | No |
strcharlength | No | |
strcomp | String.CompareTo | Yes |
strcopy | No | |
strdispose | = null | Yes |
strecopy | No | |
strend | No | |
strfmt | No | |
stricomp | String.CompareTo | Yes |
stringreplace | String.Replace | Yes |
stringtoguid | new Guid | Yes |
strlcat | No | |
strlcomp | No | |
strlcopy | No | |
strlen | No | |
strlfmt | No | |
strlicomp | No | |
strlower | String.ToLower | Yes |
strmove | No | |
strnew | No | |
strnextchar | No | |
strpas | No | |
strpcopy | No | |
strplcopy | No | |
strpos | String.IndexOf | Yes |
strrscan | String.LastIndexOf | Yes |
strscan | String.IndexOf | Yes |
strtobool | Convert.ToBoolean | Yes |
strtobooldef | No | |
strtocurr | Convert.ToDecimal | Yes |
strtocurrdef | No | |
strtodate | Convert.ToDateTime | Yes |
strtodatedef | No | |
strtodatetime | Convert.ToDateTime | Yes |
strtodatetimedef | No | |
strtofloat | Convert.ToSingle | Yes |
strtofloatdef | No | |
strtoint | Convert.ToInt32 | Yes |
strtoint64 | Convert.ToInt64 | Yes |
strtoint64def | No | |
strtointdef | No | |
strtotime | Convert.ToDateTime | Yes |
strtotimedef | No | |
strupper | String.ToUpper | Yes |
supports | No | |
syserrormessage | No | |
systemtimetodatetime | No | |
texttofloat | No | |
time | DateTime.Now | Yes |
timestamptodatetime | No | |
timestamptomsecs | No | |
timetostr | DateTime.ToString | Yes |
trim | String.Trim | Yes |
trimleft | String.TrimStart | Yes |
trimright | String.TrimEnd | Yes |
trims | No | |
trueboolstrs | No | |
tryencodedate | No | |
tryencodetime | No | |
tryfloattocurr | No | |
tryfloattodatetime | No | |
trystrtobool | No | |
trystrtocurr | No | |
trystrtodate | No | |
trystrtodatetime | No | |
trystrtofloat | No | |
trystrtoint | No | |
trystrtoint64 | No | |
trystrtotime | No | |
unixdatedelta | No | |
unloadpackage | No | |
uppercase | String.ToUpper | Yes |
widecomparestr | String.CompareTo | Yes |
widecomparetext | String.CompareTo | Yes |
widefmtstr | No | |
wideformat | No | |
wideformatbuf | No | |
widelowercase | String.ToLower | Yes |
widesamestr | String.Equals | Yes |
widesametext | String.Equals | Yes |
wideuppercase | String.ToUpper | Yes |
win32check | No | |
win32platform | No | |
wraptext | No |
Delphi | C# | Supported |
---|---|---|
comparedate | DateTime.CompareTo | Yes |
comparedatetime | Object.CompareTo | Yes |
comparetime | DateTime.TimeOfDay.CompareTo | Yes |
dateof | DateTime.Date | Yes |
datetimetojuliandate | No | |
datetimetomodifiedjuliandate | No | |
datetimetounix | No | |
dayof | .Day | Yes |
dayofthemonth | .Day | Yes |
dayoftheweek | .DayOfWeek | Yes |
dayoftheyear | .DayOfYear | Yes |
daysbetween | No | |
daysinamonth | DateTime.DaysInMonth | Yes |
daysinayear | No | |
daysinmonth | DateTime.DaysInMonth | Yes |
daysinyear | No | |
dayspan | No | |
decodedateday | Yes | |
decodedatemonthweek | Yes | |
decodedatetime | Yes | |
decodedateweek | Yes | |
decodedayofweekinmonth | No | |
encodedateday | No | |
encodedatemonthweek | No | |
encodedatetime | Yes | |
encodedateweek | No | |
encodedayofweekinmonth | No | |
endofaday | No | |
endofamonth | No | |
endofaweek | No | |
endofayear | No | |
endoftheday | No | |
endofthemonth | No | |
endoftheweek | No | |
endoftheyear | No | |
hourof | .Hour | Yes |
houroftheday | .Hour | Yes |
hourofthemonth | No | |
houroftheweek | No | |
houroftheyear | No | |
hoursbetween | No | |
hourspan | No | |
incday | .AddDays | Yes |
inchour | .AddHours | Yes |
incmillisecond | .AddMilliseconds | Yes |
incminute | .AddMinutes | Yes |
incsecond | AddSeconds | Yes |
incweek | No | |
incyear | .AddYears/td> | Yes |
isinleapyear | IsLeapYear | Yes |
ispm | Yes | |
issameday | Yes | |
istoday | Yes | |
isvaliddate | No | |
isvaliddateday | No | |
isvaliddatemonthweek | No | |
isvaliddatetime | No | |
isvaliddateweek | No | |
isvalidtime | No | |
juliandatetodatetime | No | |
millisecondof | .Millisecond | Yes |
millisecondoftheday | No | |
millisecondofthehour | No | |
millisecondoftheminute | No | |
millisecondofthemonth | No | |
millisecondofthesecond | No | |
millisecondoftheweek | No | |
millisecondoftheyear | No | |
millisecondsbetween | No | |
millisecondspan | No | |
minuteof | .Minute | Yes |
minuteoftheday | .TimeOfDay.Minutes | Yes |
minuteofthehour | No | |
minuteofthemonth | No | |
minuteoftheweek | No | |
minuteoftheyear | No | |
minutesbetween | No | |
minutespan | No | |
modifiedjuliandatetodatetime | No | |
monthof | .Month | Yes |
monthoftheyear | .Month | Yes |
monthsbetween | No | |
monthspan | No | |
nthdayofweek | No | |
onehour | No | |
onemillisecond | No | |
oneminute | No | |
onesecond | No | |
recodedate | No | |
recodedatetime | No | |
recodeday | No | |
recodehour | No | |
recodemillisecond | No | |
recodeminute | No | |
recodemonth | No | |
recodesecond | No | |
recodetime | No | |
recodeyear | No | |
samedate | Yes | |
samedatetime | Yes | |
sametime | Yes | |
secondof | .Second | Yes |
secondoftheday | .TimeOfDay.Seconds | Yes |
secondofthehour | No | |
secondoftheminute | No | |
secondofthemonth | No | |
secondoftheweek | No | |
secondoftheyear | No | |
secondsbetween | No | |
secondspan | No | |
startofaday | No | |
startofamonth | No | |
startofaweek | No | |
startofayear | No | |
startoftheday | No | |
startofthemonth | No | |
startoftheweek | No | |
startoftheyear | No | |
timeof | Yes | |
today | DateTime.ToDay | Yes |
tomorrow | Yes | |
tryencodedateday | No | |
tryencodedatemonthweek | No | |
tryencodedatetime | No | |
tryencodedateweek | No | |
tryencodedayofweekinmonth | No | |
tryjuliandatetodatetime | No | |
trymodifiedjuliandatetodatetime | No | |
tryrecodedatetime | No | |
unixtodatetime | No | |
weekof | No | |
weekofthemonth | No | |
weekoftheyear | No | |
weeksbetween | No | |
weeksinayear | No | |
weeksinyear | No | |
weekspan | No | |
withinpastdays | No | |
withinpasthours | No | |
withinpastmilliseconds | No | |
withinpastminutes | No | |
withinpastmonths | No | |
withinpastseconds | No | |
withinpastweeks | No | |
withinpastyears | No | |
yearof | .Year | Yes |
yearsbetween | No | |
yearspan | No | |
yesterday | Yes |
Delphi | C# | Supported |
---|---|---|
application | System.Windows.Forms.Application | Yes |
messagebox | MessageBox.Show | Yes |
vartostr | Object.ToString | Yes |
Delphi | C# | Supported |
---|---|---|
ansicontainsstr | String.IndexOf | Yes |
ansicontainstext | String.IndexOf | Yes |
ansiendsstr | String.EndsWith | Yes |
ansiendstext | String.EndsWith | Yes |
ansiindexstr | Array.IndexOf | Yes |
ansiindextext | Array.IndexOf | Yes |
ansileftstr | String.Substring | Yes |
ansimatchstr | Array.IndexOf | Yes |
ansimatchtext | Array.IndexOf | Yes |
ansimidstr | String.Substring | Yes |
ansireplacestr | String.Replace | Yes |
ansireplacetext | String.Replace | Yes |
ansiresemblesproc | No | |
ansiresemblestext | String.Equals | Yes |
ansireversestring | Yes | |
ansirightstr | String.Substring | Yes |
ansistartsstr | String.StartWith | Yes |
ansistartstext | String.StartWith | Yes |
decodesoundexint | No | |
decodesoundexword | No | |
dupestring | new String | Yes |
leftbstr | String.Substring | Yes |
leftstr | String.Substring | Yes |
midbstr | String.Substring | Yes |
midstr | String.Substring | Yes |
posex | String.IndexOf | Yes |
reversestring | No | |
rightbstr | String.Substring | Yes |
rightstr | String.Substring | Yes |
searchbuf | No | |
soundex | No | |
soundexcompare | No | |
soundexint | No | |
soundexproc | No | |
soundexsimilar | No | |
soundexword | No | |
stuffstring | No |
Delphi | C# | Supported |
---|---|---|
arccos | Math.ACos | Yes |
arccosh | Yes | |
arccot | Yes | |
arccoth | Yes | |
arccsc | Yes | |
arccsch | Yes | |
arcsec | Yes | |
arcsech | Yes | |
arcsin | Math.Sin | Yes |
arcsinh | Yes | |
arctan2 | Math.Atan2 | Yes |
arctanh | Yes | |
argerror | No | |
c1 | No | |
c2 | No | |
ceil | Math.Ceiling | Yes |
comparevalue | No | |
compound | No | |
cosecant | Yes | |
cosh | Math.Cosh | Yes |
cot | Yes | |
cotan | Yes | |
coth | Yes | |
csc | Yes | |
csch | Yes | |
cycletodeg | Yes | |
cycletograd | No | |
cycletorad | Yes | |
degtocycle | Yes | |
degtograd | Yes | |
degtorad | No | |
divmod | No | |
doubledecliningbalance | No | |
ensurerange | No | |
floor | Yes | |
frexp | No | |
futurevalue | No | |
gradtocycle | No | |
gradtodeg | No | |
gradtorad | Yes | |
hypot | No | |
ifthen | No | |
inrange | No | |
interestpayment | No | |
interestrate | No | |
internalrateofreturn | No | |
intpower | Math.Pow | Yes |
isinfinite | Yes | |
isnan | Yes | |
iszero | No | |
ldexp | No | |
lnxp1 | No | |
log10 | Yes | |
log2 | Yes | |
logn | Yes | |
max | Yes | |
maxcomp | Yes | |
maxdouble | Yes | |
maxextended | Yes | |
maxintvalue | Yes | |
maxsingle | Yes | |
maxvalue | Yes | |
mean | No | |
meanandstddev | No | |
min | Yes | |
mincomp | Yes | |
mindouble | Yes | |
minextended | Yes | |
minintvalue | Yes | |
minsingle | Yes | |
minvalue | Yes | |
momentskewkurtosis | No | |
netpresentvalue | No | |
norm | No | |
numberofperiods | No | |
payment | No | |
paymentparts | No | |
periodpayment | No | |
poly | No | |
polyx | No | |
popnstddev | No | |
popnvariance | No | |
power | No | |
presentvalue | No | |
radtocycle | Yes | |
radtodeg | Yes | |
radtograd | Yes | |
raiseoverflowerror | No | |
randg | No | |
randomfrom | No | |
randomrange | No | |
relsmall | No | |
roundto | No | |
samevalue | No | |
sec | Yes | |
secant | Yes | |
sech | Yes | |
sign | Math.Sign | Yes |
simpleroundto | No | |
sincos | No | |
sinh | Math.Sinh | Yes |
slndepreciation | No | |
stddev | No | |
sum | No | |
sumint | No | |
sumofsquares | No | |
sumsandsquares | No | |
syddepreciation | No | |
tan | Math.Tan | Yes |
tanh | Math.Tanh | Yes |
totalvariance | No | |
variance | No |