I m unaware of ruby language. i have the following piece of code in Ruby. I want its c# equivalent. Can anybody help me on this?
def mysql_key(key)
  final_key = "\0" * 16
  key.length.times do |i|
    final_key[i%16] ^= key[i]
  end
  final_key
end
EDIT: This is what I have so far, but its not working
public static int Ord(string str){
            byte[] asciiBytes = Encoding.ASCII.GetBytes(str);
            return Convert.ToInt32(asciiBytes[0]);
        }
       public static string final_key(string key)
        {
            int d = 0;
            int[] Final_key ={0x16} ;
            foreach (char c in key)
            {
                Final_key[d % 16] = Convert.ToChar((Ord(Final_key[d % 16].ToString()) ^ Ord(Final_key[d].ToString())));
                d++;
            }
            return Final_key.ToString();
        }
P.S. I m fairly new in C# as well.
Any help will highly be appreciable Thanks