Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. is there any binary to decimal convertor class

is there any binary to decimal convertor class

Scheduled Pinned Locked Moved C#
question
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hotthoughtguy
    wrote on last edited by
    #1

    is there any class that converts in different number system?

    L D 2 Replies Last reply
    0
    • H hotthoughtguy

      is there any class that converts in different number system?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, numbers don't have a base, it is only when they are converted to/from strings that a base applies. have a look at Convert.ToInt32(String, Int32) and Convert.ToString(Int32, Int32) [and similar for other types] :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      H 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, numbers don't have a base, it is only when they are converted to/from strings that a base applies. have a look at Convert.ToInt32(String, Int32) and Convert.ToString(Int32, Int32) [and similar for other types] :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        H Offline
        H Offline
        hotthoughtguy
        wrote on last edited by
        #3

        no. i mean what if i want to convert FFFF to binary or octal or any other format?

        L realJSOPR 2 Replies Last reply
        0
        • H hotthoughtguy

          no. i mean what if i want to convert FFFF to binary or octal or any other format?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          you can convert "FFFF" to an int32 and then to "1111111111111111" or "00000000000000001111111111111111" with the methods I indicated earlier. or you can write your own code to convert one string in another, which is harder to do, and does not really offer any advantage. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          1 Reply Last reply
          0
          • H hotthoughtguy

            no. i mean what if i want to convert FFFF to binary or octal or any other format?

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            FFFF is already in the desired "format". You just need to choose the correct string format so you can see it in the desired representation.

            Int32 i = 200;
            String oct = Convert.ToString(i, 8); // gives "310"

            .45 ACP - because shooting twice is just silly
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

            1 Reply Last reply
            0
            • H hotthoughtguy

              is there any class that converts in different number system?

              D Offline
              D Offline
              DaveyM69
              wrote on last edited by
              #6

              Check out this old article[^] of mine

              Dave
              BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
              Why are you using VB6? Do you hate yourself? (Christian Graus)

              H 1 Reply Last reply
              0
              • D DaveyM69

                Check out this old article[^] of mine

                Dave
                BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                Why are you using VB6? Do you hate yourself? (Christian Graus)

                H Offline
                H Offline
                hotthoughtguy
                wrote on last edited by
                #7

                thanks a lot

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups