hello
In C#, use System.Text.Encoding, which has identical behaviour to the function in VB.NET.
byte[] abData;
string Str;
int i;
Str = "Hello world!";
// Convert string to bytes
abData = System.Text.Encoding.Default.GetBytes(Str);
for (i = 0; i < abData.Length; i++)
{
Console.WriteLine("{0:X}", abData[i]);
}
// Convert bytes to string
Str = System.Text.Encoding.Default.GetString(abData);
Console.WriteLine("'{0}'", Str);
reference for vb.net vb6 vba and more
http://cryptosys.net/cgi-bin/manual.cgi?m=pki&name=stringstobytes