<?xml version="1.0" encoding="UTF-8"?><item><title>Parsing hex numbers, and .NET class library discoverability.</title><description>&lt;span id="PostFlatView"&gt;											&#13;
															Someone emailed me a question, asking how to convert a number&#13;
represented as a hexadecimal string into a number you can work with, so&#13;
I thought I'd post the answer here for Google to find.&lt;br&gt;&#13;
&lt;br&gt;&#13;
&amp;nbsp; string hexNumber = "4000";&lt;br&gt;&#13;
&amp;nbsp; int x = Int32.Parse(hexNumber, NumberStyles.HexNumber);&lt;br&gt;&#13;
&amp;nbsp; Console.WriteLine(x);&amp;nbsp; // prints 16384&lt;br&gt;&#13;
&lt;br&gt;&#13;
Quite often I find that discoverability in the framework isn't as good&#13;
as it could be because functionality related to one class is actually&#13;
provided as a static in another class.&amp;nbsp; &lt;br&gt;&#13;
&lt;br&gt;&#13;
For example if you have an array of strings:&lt;br&gt;&#13;
&lt;br&gt;&#13;
&amp;nbsp; string[] names = new string[42];&lt;br&gt;&#13;
&lt;br&gt;&#13;
And you want to sort it, typing "names." won't find you the Sort&#13;
method.&amp;nbsp; You have to type "Array." to see the Array.Sort static&#13;
method.&amp;nbsp; A lot of handy functionality is provided this way, and is&#13;
very difficult to discover.&lt;br&gt;&#13;
&lt;br&gt;&#13;
One class especially worth knowing is Convert. &lt;br&gt;&#13;
&lt;br&gt;&#13;
Not that this has anything to with the question, but it's something&#13;
worth being aware of.&amp;nbsp; I've seen a few mentions recently of&#13;
'missing' functionality in the framework, that was actually there, but&#13;
not easy to find.&lt;br&gt;&#13;
&lt;br&gt;&#13;
&lt;/span&gt;</description><pubDate>Thu, 01 Sep 2005 19:17:09 GMT</pubDate></item>