Get program code when a button is pressed in C #

I designed a window shape in which I placed 3 buttons and a richtextBox.
Now I want to get the program code in richtextbox with different button presses, which I wrote in the click () event of each button.

Example

private void button1_Click(object sender, ButtonEventArgs e)
{
       some code lines goes here   // 
       ....                        // All these lines to be displayed in richtextBox
       ....                        //
}
+3
source share
2 answers

I think you will need to actually connect and read the source files for this. After your application is compiled, your C # code becomes IL code and does not look the same at all.

+2
source

When you execute, it no longer has a source, since it is compiled to IL, if you want to display a line when a button is clicked, just do it.

richTextBox.Text = @"some code lines goes here...
...
...";
0
source

All Articles