M
Mel Weaver
Hello,
I looking for different ideas on how to convert this delphi code to c#,
mostly the constant array.
procedure PhysDmgSymbol(sym : string; yr: integer);
type
d = record
s : String;
r : array[1..4] of double;
end;
const a1 : array[0..19]of d = ((s:'01';r1.55,1.18,1.55,1.18)),
(s:'02';r1.55,1.18,2.15,1.50)),
(s:'03';r1.55,1.18,2.85,1.60)),
(s:'04';r1.55,1.18,2.95,1.70)),
(s:'05';r1.55,1.18,3.40,1.80)),
(s:'06';r1.55,1.18,3.60,1.95)),
(s:'07';r2.15,1.50,3.90,2.00)),
(s:'08';r2.85,1.60,4.20,2.10)),
(s:'10';r3.51,1.80,4.90,2.20)),
(s:'11';r3.90,2.00,5.20,2.30)),
(s:'12';r4.90,2.20,5.80,2.40)),
(s:'13';r5.80,2.40,6.00,2.50)),
(s:'14';r6.60,2.80,6.60,2.80)),
(s:'15';r7.60,3.15,7.00,3.00)),
(s:'16';r9.00,3.40,7.60,3.15)),
(s:'17';r10.30,4.40,8.00,3.30)),
(s:'18';r0.00,0.00,9.00,3.40)),
(s:'19';r0.00,0.00,9.70,3.60)),
(s:'20';r0.00,0.00,10.30,4.60)),
(s:'21';r0.00,0.00,10.90,4.60)));
var
i : integer;
begin
for i := low(a1) to high(a1) do
begin
if sym = a1.s then
begin
nCompFactor := ifthen(yr > 1989,a1.r[3],a1.r[1]);
nCollFactor := ifthen(yr > 1989,a1.r[4],a1.r[2]);
exit;
end;
end;
end;
Thanks
Mel
I looking for different ideas on how to convert this delphi code to c#,
mostly the constant array.
procedure PhysDmgSymbol(sym : string; yr: integer);
type
d = record
s : String;
r : array[1..4] of double;
end;
const a1 : array[0..19]of d = ((s:'01';r1.55,1.18,1.55,1.18)),
(s:'02';r1.55,1.18,2.15,1.50)),
(s:'03';r1.55,1.18,2.85,1.60)),
(s:'04';r1.55,1.18,2.95,1.70)),
(s:'05';r1.55,1.18,3.40,1.80)),
(s:'06';r1.55,1.18,3.60,1.95)),
(s:'07';r2.15,1.50,3.90,2.00)),
(s:'08';r2.85,1.60,4.20,2.10)),
(s:'10';r3.51,1.80,4.90,2.20)),
(s:'11';r3.90,2.00,5.20,2.30)),
(s:'12';r4.90,2.20,5.80,2.40)),
(s:'13';r5.80,2.40,6.00,2.50)),
(s:'14';r6.60,2.80,6.60,2.80)),
(s:'15';r7.60,3.15,7.00,3.00)),
(s:'16';r9.00,3.40,7.60,3.15)),
(s:'17';r10.30,4.40,8.00,3.30)),
(s:'18';r0.00,0.00,9.00,3.40)),
(s:'19';r0.00,0.00,9.70,3.60)),
(s:'20';r0.00,0.00,10.30,4.60)),
(s:'21';r0.00,0.00,10.90,4.60)));
var
i : integer;
begin
for i := low(a1) to high(a1) do
begin
if sym = a1.s then
begin
nCompFactor := ifthen(yr > 1989,a1.r[3],a1.r[1]);
nCollFactor := ifthen(yr > 1989,a1.r[4],a1.r[2]);
exit;
end;
end;
end;
Thanks
Mel