Take the 2-minute tour ×  For some reason the following C#
Console program always outputs:   What am I doing wrong?  using
System.Collections.Generic; using System.Linq; using
System.Text; using System.Globalization;  namespace
ConsoleApplication1     class Program         static void
Main(string[] args)
Console.WriteLine(Convert.ToUInt32("0x20", 16));
UInt32 wtf = 0;
NumberStyles.HexNumber, // I've tried also AllowHexSpecifier
CultureInfo.InvariantCulture,  // I've also tried CurrentCulture
out wtf));             Console.WriteLine("wtf={0}", wtf);
share|improve this question IIRC, Java has the same silliness.
–  leppie Jul 20 '11 at 13:05  4 Answers 4  up vote 10 down vote
accepted  You need to drop the "0x" prefix. Please see this blog
entry  share|improve this answer You're absolutely right. So,
does every C# programmer manually "trim-off" any "0x" (if
present) or is there a short-cut? BTW: I'l