有这样一个Delphi算法,有谁能翻译成Asp.Net (C#)呢?
Function Lkpn(const s: string; key: DWORD): string;
var
  i: longint;
  DecS: string;
begin
  DecS := s;
  for i := 1 to length(s) do
  begin
    DecS[i] := char(byte(DecS[i]) xor (key shr 4));
  end;
  result := DecS;
end;

解决方案 »

  1.   

    唉 我给你写一个吧  记得给分啊    Function LKPN(ByVal S As String, ByVal Key As UInteger ) As String
            Dim i As Integer
            Dim result As String = String.Empty
            For i = 0 To S.Length - 1
                result += Chr(Asc(S(i)) Xor Key >> 4)
            Next
            Return result
        End Function
      

  2.   

    上面是VB.NET 下面这个是C# public string LKPN(string S, uint Key)
    {
    string functionReturnValue = null;
    int i;
    string result = string.Empty;
    for (i = 0; i <= S.Length - 1; i++) {
    result += Strings.Chr(Strings.Asc(S(i)) ^ Key >> 4);
    }
    return result;
    return functionReturnValue;
    }记得给分