Is there any built-in way to convert an integer to a string (of any base) in C#?

前端 未结 6 2029
梦毁少年i
梦毁少年i 2020-12-20 20:02

Convert.ToString() only allows base values of 2, 8, 10, and 16 for some odd reason; is there some obscure way of providing any base between 2 and 16?

6条回答
  •  我在风中等你
    2020-12-20 20:39

    Sorry, I'm not answering your question but... The choice of bases is not arbitary. You pc is constantly converting from base 2 (it's internal binary system) to the human readable base 10. Base 8 and 16 are very easy to convert to and from base 2 and are often used so a computer AND a human can read the value (e.g. GUIDs)

提交回复
热议问题