请教异或校验问题
我用C#编写,想求一串二进制字符串按位进行异或.   
 例如: a   b   c   d   e   f   g   ....字符串的长度是可变的.   
 a与b异或结果与c异或,结果再与d异或,依次最后求一个异或结果.     
 请问我该用怎样的循环来解决,
------解决方案--------------------string str =  "abcedgee "; 
 byte result = (byte)0; 
 for(int index=0; index <str.Length; index++) 
 { 
     result ^= (byte)str[index]; 
 } 
 return result;