XOR-ing strings in C#
I recently started playing around with C#, and I'm trying to understand why the following code doesn't compile. On the line with the error comment, I get: Cannot implicitly convert type 'int' to 'char'. An explicit conversion exits (are you missing a cast?) I'm trying to do a simple XOR operation with two strings. public string calcXor (string a, string b) { char[] charAArray = a.ToCharArray(); char[] charBArray = b.ToCharArray(); char[] result = new char[6]; int len = 0; // Set length to be the length of the shorter string if (a.Length > b.Length) len = b.Length - 1; else len = a.Length - 1;