CSharp examples for System:Hex
String To Hex
using System.Text; using System.Linq; using System.Collections.Generic; using System;//from ww w.j a va 2 s . co m public class Main{ public static string ToHex(this string str) { StringBuilder sb = new StringBuilder(); foreach (int charCode in str) { string hex1 = Convert.ToString(charCode, 16); string hex = hex1.PadLeft(2, '0'); sb.Append(hex); } return sb.ToString(); } }