This question already has answers here:
Closed 7 years ago.
Possible Duplicate: C# - Convert a string of hex values to hex
I converted the following code from Visual Basic to C#. But how do I know how I can use Hex in C#?
private string ConvertStringToHex(string sText)
{
int lCount;
string sHex;
string sResult;
for (lCount = 1; (lCount <= sText.Length); lCount++)
{
sHex = Hex(Convert.ToInt32(sText.Substring((lCount - 1), 1)));
if ((sHex.Length == 1))
{
sHex = ("0" + sHex);
}
sResult = (sResult + sHex);
}
return sResult;
}