Possible Duplicate:
Equivalent of getBytes() in Java to C#
In Java:
String s="abcde";
byte bar[] = s.getBytes();
In C#:
for (int i = 0; i < s.Length; i++)
{
bar[i] = Convert.ToByte(s.Substring(i, 1));
}
I worked Java example getBytes to convert C# code. But the above C# code does not work.