i know how to write MSIL code but out of curiosity i would like to know if there is a workaround to write assembly code. I can think of a way like writing the code in a string and passing it to a native windows api that executes and returns the result but not sure if this is real or even possible.
i would like to hear your opinions/suggestions.Thanks
We can write assembly program code inside c language program. In such case, all the assembly code must be placed inside asm{} block. Let's see a simple assembly program code to add two numbers in c program.
In C#, you can use two versions of the same assembly in a single application.
Assembly is a single deployable unit and consists of the MSIL, metadata, etc. Assemblies can be DLL or . EXE. Assembly is providing security and type boundary also.
No it is not possible to write assembly code directly in C# or VB.Net.
The closest you can get to doing this is to separate the assembly code into a native DLL which exported C style function entry points. Then PInvoke into those entry points from the C# / VB.Net application.
Another option is to use C++/CLI as it's possible to inline assembly into a C++/CLI project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With