== 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[]
Source: [[http://www.netcoole.com/delphi2cs/datatype.htm]] == Delphi vs. C# Operators ==
Delphi C#
* *
/ /
\ /
Mod %
Div \
+ +
- -
<<
<=<=
>>
>=>=
<>!=
===
Not !
Xor ^
Shl <<
Shr >>
Or ||
And &&
In (UNSUPPORT)
As type cast
Is is
@ (UNSUPPORT)
^(pointer) (UNSUPPORT)
Source: http://www.netcoole.com/delphi2cs/operators.htm == Delphi vs. C# Statements ==
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
Source: http://www.netcoole.com/delphi2cs/statements.htm == Delphi vs. C# Routines == === SysUtils ==
Delphi C# Supported
abort new ExceptionYes
addexitproc No
addterminateproc No
adjustlinebreaks No
allocmem No
ansicomparefilename String.CompareToYes
ansicomparestr String.CompareToYes
ansicomparetext String.CompareToYes
ansidequotedstr No
ansiextractquotedstr No
ansilastchar No
ansilowercase String.ToLowerYes
ansilowercasefilenameString.ToLowerYes
ansipos String.IndexOfYes
ansiquotedstr No
ansisamestr String.EqulsYes
ansisametext String.EqulsYes
ansistrcomp String.CompareToYes
ansistricomp String.CompareToYes
ansistrlastchar No
ansistrlcomp String.CompareToYes
ansistrlicomp String.CompareToYes
ansistrlower String.ToLowerYes
ansistrpos String.IndexOfYes
ansistrrscan String.LastIndexOfYes
ansistrscan String.IndexOfYes
ansistrupper String.ToUpperYes
ansiuppercase String.ToUpperYes
ansiuppercasefilenameString.ToUpperYes
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.CompareToYes
comparetext String.CompareToYes
createdir Directory.CreateDirectoryYes
createguid No
currentyear DateTime.Today.YearYes
currtostr No
currtostrf No
date DateTime.TodayYes
datedelta 693594Yes
datetimetofiledate No
datetimetostr Yes
datetimetostring Yes
datetimetosystemtime Yes
datetimetotimestamp Yes
datetostr Yes
dayofweek DateTime.DayOfWeekYes
decodedate No
decodedatefully No
decodetime No
deletefile File.DeleteYes
directoryexists Directory.ExistsYes
diskfree No
disksize No
disposestr No
dllproc No
encodedate No
encodetime No
exceptionerrormessage No
excludetrailingbackslash Path.GetDirectoryNameYes
excludetrailingpathdelimiter Path.GetDirectoryNameYes
expandfilename Path.GetFullPathYes
expandfilenamecase Path.GetFullPathYes
expanduncfilename No
extractfiledir Path.GetDirectoryNameYes
extractfiledrive Path.GetPathRootYes
extractfileext Path.GetExtensionYes
extractfilename Path.GetFileNameYes
extractfilepath Path.GetDirectoryNameYes
extractrelativepath No
extractshortpathname No
falseboolstrs No
fileage No
fileclose File.CloseYes
filecreate File.CreateYes
filedatetodatetime No
fileexists File.ExistsYes
filegetattr File.GetAttributesYes
filegetdate File.GetCreationTimeYes
fileisreadonly Yes
fileopen File.OpenYes
fileread No
filesearch No
fileseek No
filesetattr File.SetAttributesYes
filesetdate No
filesetreadonly No
filewrite No
finalizepackage No
findclose No
findcmdlineswitch No
findfirst No
findnext No
floattocurr Convert.ToDecimalYes
floattodatetime Convert.ToDateTimeYes
floattodecimal Convert.ToDecimalYes
floattostr Convert.ToStringYes
floattostrf Convert.ToStringYes
floattotext Convert.ToStringYes
floattotextfmt No
fmtloadstr No
fmtstr No
forcedirectories Directory.CreateDirectoryYes
format No
formatbuf No
formatcurr No
formatdatetime No
formatfloat No
freeandnil No
getcurrentdir Environment.CurrentDirectoryYes
getenvironmentvariable Environment.GetEnvironmentVariableYes
getfileversion No
getformatsettings No
getlocaleformatsettings No
getmodulename No
getpackagedescription No
getpackageinfo No
gettime DateTime.NowYes
guidtostring No
hinstance No
incamonth DateTime.AddMonthsYes
includetrailingbackslash No
includetrailingpathdelimiter No
incmonth DateTime.AddMonthsNo
initializepackage No
interlockeddecrement No
interlockedexchange No
interlockedexchangeadd No
interlockedincrement No
inttohex Int32.ToString("x")Yes
inttostr Inr32.toStringYes
isdelimiter No
isequalguid No
isleapyear DateTime.IsLeapYearYes
ispathdelimiter No
isvalidident No
languages No
lastdelimiter No
leadbytes No
loadpackage No
loadstr No
lowercase String.ToLowerYes
msecstotimestamp No
newstr No
nextcharindex No
now DateTime.NowYes
nullstr No
outofmemoryerror No
quotedstr No
raiselastoserror No
raiselastwin32error No
removedir Directory.DeleteYes
renamefile File.MoveYes
replacedate No
replacetime No
safeloadlibrary No
samefilename String.EqualsYes
sametext String.EqualsYes
setcurrentdir Environment.CurrentDirectory = valueYes
showexception No
sleep Thread.CurrentThread.SleepYes
stralloc No
strbufsize String.LengthYes
strbytetype No
strcat +No
strcharlength No
strcomp String.CompareToYes
strcopy No
strdispose = nullYes
strecopy No
strend No
strfmt No
stricomp String.CompareToYes
stringreplace String.ReplaceYes
stringtoguid new GuidYes
strlcat No
strlcomp No
strlcopy No
strlen No
strlfmt No
strlicomp No
strlower String.ToLowerYes
strmove No
strnew No
strnextchar No
strpas No
strpcopy No
strplcopy No
strpos String.IndexOfYes
strrscan String.LastIndexOfYes
strscan String.IndexOfYes
strtobool Convert.ToBooleanYes
strtobooldef No
strtocurr Convert.ToDecimalYes
strtocurrdef No
strtodate Convert.ToDateTimeYes
strtodatedef No
strtodatetime Convert.ToDateTimeYes
strtodatetimedef No
strtofloat Convert.ToSingleYes
strtofloatdef No
strtoint Convert.ToInt32Yes
strtoint64 Convert.ToInt64Yes
strtoint64def No
strtointdef No
strtotime Convert.ToDateTimeYes
strtotimedef No
strupper String.ToUpperYes
supports No
syserrormessage No
systemtimetodatetime No
texttofloat No
time DateTime.NowYes
timestamptodatetime No
timestamptomsecs No
timetostr DateTime.ToStringYes
trim String.TrimYes
trimleft String.TrimStartYes
trimright String.TrimEndYes
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.ToUpperYes
widecomparestr String.CompareToYes
widecomparetext String.CompareToYes
widefmtstr No
wideformat No
wideformatbuf No
widelowercase String.ToLowerYes
widesamestr String.EqualsYes
widesametext String.EqualsYes
wideuppercase String.ToUpperYes
win32check No
win32platform No
wraptext No
Source: http://www.netcoole.com/delphi2cs/routines/sysutilsroutines.htm === DateUtils ===
Delphi C# Supported
comparedateDateTime.CompareToYes
comparedatetime Object.CompareToYes
comparetime DateTime.TimeOfDay.CompareToYes
dateof DateTime.DateYes
datetimetojuliandate No
datetimetomodifiedjuliandate No
datetimetounix No
dayof .DayYes
dayofthemonth.DayYes
dayoftheweek .DayOfWeekYes
dayoftheyear .DayOfYearYes
daysbetween No
daysinamonth DateTime.DaysInMonthYes
daysinayear No
daysinmonth DateTime.DaysInMonthYes
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 .HourYes
houroftheday .HourYes
hourofthemonth No
houroftheweek No
houroftheyear No
hoursbetween No
hourspan No
incday .AddDaysYes
inchour .AddHoursYes
incmillisecond .AddMillisecondsYes
incminute .AddMinutesYes
incsecond AddSecondsYes
incweek No
incyear .AddYears/td>Yes
isinleapyear IsLeapYearYes
ispm Yes
issameday Yes
istoday Yes
isvaliddate No
isvaliddateday No
isvaliddatemonthweek No
isvaliddatetime No
isvaliddateweek No
isvalidtime No
juliandatetodatetime No
millisecondof .MillisecondYes
millisecondoftheday No
millisecondofthehour No
millisecondoftheminute No
millisecondofthemonth No
millisecondofthesecond No
millisecondoftheweek No
millisecondoftheyear No
millisecondsbetween No
millisecondspan No
minuteof .MinuteYes
minuteoftheday .TimeOfDay.MinutesYes
minuteofthehour No
minuteofthemonth No
minuteoftheweek No
minuteoftheyear No
minutesbetween No
minutespan No
modifiedjuliandatetodatetime No
monthof .MonthYes
monthoftheyear .MonthYes
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 .SecondYes
secondoftheday .TimeOfDay.SecondsYes
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.ToDayYes
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 .YearYes
yearsbetween No
yearspan No
yesterday Yes
Source: http://www.netcoole.com/delphi2cs/routines/dateutilsroutines.htm === Miscellaneous ===
Delphi C# Supported
applicationSystem.Windows.Forms.ApplicationYes
messageboxMessageBox.ShowYes
vartostrObject.ToStringYes
=== StrUtils ===
Delphi C# Supported
ansicontainsstr String.IndexOfYes
ansicontainstext String.IndexOfYes
ansiendsstr String.EndsWithYes
ansiendstext String.EndsWithYes
ansiindexstr Array.IndexOfYes
ansiindextext Array.IndexOfYes
ansileftstr String.SubstringYes
ansimatchstr Array.IndexOfYes
ansimatchtext Array.IndexOfYes
ansimidstr String.SubstringYes
ansireplacestr String.ReplaceYes
ansireplacetext String.ReplaceYes
ansiresemblesproc No
ansiresemblestext String.EqualsYes
ansireversestring Yes
ansirightstr String.SubstringYes
ansistartsstr String.StartWithYes
ansistartstext String.StartWithYes
decodesoundexint No
decodesoundexword No
dupestring new StringYes
leftbstr String.SubstringYes
leftstr String.SubstringYes
midbstr String.SubstringYes
midstr String.SubstringYes
posex String.IndexOfYes
reversestring No
rightbstr String.SubstringYes
rightstr String.SubstringYes
searchbuf No
soundex No
soundexcompare No
soundexint No
soundexproc No
soundexsimilar No
soundexword No
stuffstring No
Source: http://www.netcoole.com/delphi2cs/routines/strutilsroutines.htm === Math ===
Delphi C# Supported
arccos Math.ACosYes
arccosh Yes
arccot Yes
arccoth Yes
arccsc Yes
arccsch Yes
arcsec Yes
arcsech Yes
arcsin Math.SinYes
arcsinh Yes
arctan2 Math.Atan2Yes
arctanh Yes
argerror No
c1 No
c2 No
ceil Math.CeilingYes
comparevalue No
compound No
cosecant Yes
cosh Math.CoshYes
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.PowYes
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.SignYes
simpleroundto No
sincos No
sinh Math.SinhYes
slndepreciation No
stddev No
sum No
sumint No
sumofsquares No
sumsandsquares No
syddepreciation No
tan Math.TanYes
tanh Math.TanhYes
totalvariance No
variance No
Source: http://www.netcoole.com/delphi2cs/routines/mathroutines.htm