Click here to Skip to main content
15,894,460 members
Home / Discussions / C#
   

C#

 
QuestionDegrees, minutes and seconds to Decimal Degrees Pin
Darrall26-Mar-10 12:12
Darrall26-Mar-10 12:12 
AnswerRe: Degrees, minutes and seconds to Decimal Degrees Pin
Tarakeshwar Reddy26-Mar-10 12:23
professionalTarakeshwar Reddy26-Mar-10 12:23 
AnswerRe: Degrees, minutes and seconds to Decimal Degrees Pin
Roger Wright26-Mar-10 17:04
professionalRoger Wright26-Mar-10 17:04 
GeneralRe: Degrees, minutes and seconds to Decimal Degrees Pin
Darrall27-Mar-10 3:59
Darrall27-Mar-10 3:59 
Questionimplementing keyValue pair, with key as a Pair (2 valued key) Pin
edankk26-Mar-10 10:09
edankk26-Mar-10 10:09 
AnswerRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
Ian Shlasko26-Mar-10 11:04
Ian Shlasko26-Mar-10 11:04 
GeneralRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
edankk26-Mar-10 11:29
edankk26-Mar-10 11:29 
GeneralRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
Ian Shlasko26-Mar-10 11:49
Ian Shlasko26-Mar-10 11:49 
GeneralRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
edankk26-Mar-10 12:03
edankk26-Mar-10 12:03 
GeneralRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
Ian Shlasko26-Mar-10 12:12
Ian Shlasko26-Mar-10 12:12 
GeneralRe: implementing keyValue pair, with key as a Pair (2 valued key) Pin
edankk26-Mar-10 12:25
edankk26-Mar-10 12:25 
QuestionC# ActiveX & javascript Pin
Mohammad A Gdeisat26-Mar-10 7:30
Mohammad A Gdeisat26-Mar-10 7:30 
AnswerRepost Pin
Not Active26-Mar-10 7:49
mentorNot Active26-Mar-10 7:49 
GeneralRe: Repost Pin
Mohammad A Gdeisat26-Mar-10 9:37
Mohammad A Gdeisat26-Mar-10 9:37 
GeneralRe: Repost Pin
Not Active26-Mar-10 9:57
mentorNot Active26-Mar-10 9:57 
GeneralRe: Repost Pin
DaveyM6926-Mar-10 16:28
professionalDaveyM6926-Mar-10 16:28 
QuestionGet current page source from a toolbar Pin
Kirys26-Mar-10 5:09
Kirys26-Mar-10 5:09 
AnswerRe: Get current page source from a toolbar Pin
Kirys29-Mar-10 6:02
Kirys29-Mar-10 6:02 
Questionhow to string to binary Pin
tai-fun26-Mar-10 4:56
tai-fun26-Mar-10 4:56 
AnswerRe: how to string to binary Pin
Richard MacCutchan26-Mar-10 5:00
mveRichard MacCutchan26-Mar-10 5:00 
AnswerRe: how to string to binary Pin
OriginalGriff26-Mar-10 5:14
mveOriginalGriff26-Mar-10 5:14 
AnswerRe: how to string to binary Pin
tai-fun26-Mar-10 5:17
tai-fun26-Mar-10 5:17 
GeneralRe: how to string to binary Pin
harold aptroot26-Mar-10 5:59
harold aptroot26-Mar-10 5:59 
AnswerRe: how to string to binary Pin
Luc Pattyn26-Mar-10 5:21
sitebuilderLuc Pattyn26-Mar-10 5:21 
Hi,

let me put a couple of things straight first: there are no decimal numbers, no hexadecimal numbers, no binary numbers, there are just numbers. A number is a number, it does not have a base.

It is only when a number gets represented by a string (maybe because it gets shown to the user, or input by the user) that it becomes a decimal, hexadecimal, binary, or whatever representation of that number.

And here are some typical operations:
int num=20;
string decimal1=num.ToString();
string decimal2=num.ToString("D5");
Console.WriteLine("decimal representation: "+decimal1);

string hex4=num.ToString("X4");
Console.WriteLine("hexdecimal representation: "+hex4);
int val16;
int32.TryParse(hex4, NumberStyles.Hexadecimal, null, out val16);
Console.WriteLine("The value of hex "+hex4+" is "+val16);

string binary=Convert.ToString(num, 2);
int val2=Convert.ToInt32(binary, 2);
Console.WriteLine("The value of binary "+binary+" is "+val2);

string octal=Convert.ToString(num, 8);
int val8=Convert.ToInt32(binary, 8);
Console.WriteLine("The value of octal"+octal+" is "+val8);


Smile | :)

GeneralRe: how to string to binary Pin
tai-fun26-Mar-10 5:51
tai-fun26-Mar-10 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.