Convertir una cadena string a Hexadecimal c# .net Forma 1

//el método recibe la cadena como parametro y convierte cada letra a su equivalennte valor en hexadecimal.

public string StringToHex(string buffer)


char[] a;

int i;

string temp = "";

a = buffer.ToCharArray();

for (i = 0; i < buffer.Length; i++)


if (a[i] > 1000)


temp = temp + Uri.HexEscape(a[i]);


return temp.Replace("%", "");



About omaracostacasas

This entry was posted in Microsoft .NET. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s