Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ok so here is my problem.

i know how to convert decimal numbers to octal and hexadecimal numbers in c# but i cant do it in assembly. Is there a way for me to easily convert c# programs to assembly?

thanks!
Posted

Ummm, all of those are integer types, just with different bases. The point at which they become "hex" or "octal" is when they're displayed, but their internal representation are always the same.
 
Share this answer
 
Surprise! There are not octal or hexadecimal or decimal numbers in programming, so there is nothing to "convert". If in you programming language they are written in different base, in machine they are all "binary". You do not "convert" them, you simply assign one to another, no matter how are they presented in the text of the code. (Have you ever heard the source code is compiled? Do you have any idea what it does?)

If you need to present a number on screen, you create its textual representation and it is called "formatting". If you read textual representation (from file, for example) and need to make a binary integer of some type; this is called "parsing" and can be successful or not.

Sorry, I don't see any sense in writing any sample code here. You need to understand basic things first. At the moment, you're not ready to write or even read any code.

—SA
 
Share this answer
 
C# targets the CLR, so the closest assembly language equivalent from a .NET perspective would be MSIL. And yes, you can convert C# to readable MSIL. There are several tools that do that including free ones.

If you really want to learn assembly language, then you need to pick up a good book and start on it. Although unless you've done some native programming in C or C++ it will be a significant change.
 
Share this answer
 
Comments
Espen Harlinn 7-Feb-11 14:59pm    
Well, it's fun though :)
Nish Nishant 7-Feb-11 15:00pm    
For a very specific definition of "fun" :-)
There is this: Static Compilation in Mono[^] - I would recommend learning a bit about assembly anyway, it's fun - and you'll end up with a far better understanding of programming in general :)

You'll probably have to disassemble the generated executable to see any assembly - or check other command line options for the mono tools

Regards
Espen Harlinn
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900