Hidden among the To(integral-type) methods are overloads that parse numbers in another base:

image_pdfimage_print
   
  

using System;
public class MainClass {
    public static void Main() {

        int thirty = Convert.ToInt32("1E", 16);      // parse in hexadecimal
        uint five = Convert.ToUInt32("101", 2);      // parse in binary

    }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.