Does the .NET framework provide any way to convert between number bases? Let`s say from decimal to hex. I`ve tried searching MSDN. Can`t find anything ther. Guess i have to write my own code for that...
Converting between number bases in C#
Converting between number bases in C#
|
|
Mar 3 2006, 10:08 AM, updated 20y ago
Show posts by this member only | Post
#1
|
![]() ![]()
Junior Member
107 posts Joined: Nov 2005 From: Kât Lởng Po |
Does the .NET framework provide any way to convert between number bases? Let`s say from decimal to hex. I`ve tried searching MSDN. Can`t find anything ther. Guess i have to write my own code for that...
|
|
|
Mar 3 2006, 11:06 AM
Show posts by this member only | Post
#2
|
![]() ![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
4,637 posts Joined: Jan 2003 From: Where i come from? |
Google is yr best fren
Have u try at this method : Convert.ToString(value,base) method? |
|
|
Mar 3 2006, 11:22 AM
Show posts by this member only | Post
#3
|
|
Elite
1,828 posts Joined: Jan 2003 |
QUOTE(nazo @ Mar 3 2006, 10:08 AM) Does the .NET framework provide any way to convert between number bases? Let`s say from decimal to hex. I`ve tried searching MSDN. Can`t find anything ther. Guess i have to write my own code for that... All the number in the computer are stored as binary. So, internally it is all converted to dec or hex for display. I assume you mean to display the number in hex in string? IN Microsoft.VisualBasic.dll Public Shared Function Oct( _ ByVal Number As { Byte | Short | Integer | Long | Object } _ ) As String Public Shared Function Hex( _ ByVal Number As { Byte | Short | Integer | Long | Object } _ ) As String or you can just use System.String.Format, adjust the format specifier. |
| Change to: | 0.0115sec
0.32
5 queries
GZIP Disabled
Time is now: 24th December 2025 - 07:34 AM |