请教:Delphi转C#问题
那位大哥能帮我把下面的Delphi转化为C#的,谢谢了
Function Encode(strCode : String) : String ;
var
i : Integer;
P, AscP : String;
begin
i := 1;
While i <= Length(strCode) do
begin
P := copy(strCode, i, 1);
If i Mod 3 = 1 Then
AscP := AscP + Chr(Ord(P[1])+3)
Else If i Mod 3 = 2 Then
AscP := AscP + Chr(ord(P[1]) + 5)
Else
AscP := AscP + Chr(ord(P[1]) + 1);
i := i + 1;
end;
result := AscP;
End ;
Function Decode(strPass : String) : String;
var
i : Integer ;
P, AscP : String ;
begin
i := 1;
While i <= Length(strPass) do
begin
P := copy(strPass, i, 1);
If i Mod 3 = 1 Then
AscP := AscP + Chr((ord(P[1]) - 3))
Else If i Mod 3 = 2 Then
AscP := AscP + Chr((ord(P[1]) - 5))
Else
AscP := AscP + Chr((ord(P[1]) - 1));
i := i + 1 ;
end;
result := AscP;
End ;