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
You could assemble it from C#, and pass the generated machine code to a C function like this through P/Invoke.
You’d need to worry about making sure that the memory region is executable, but that’s beyond the scope of this answer.