Challenge: Write a program that can display its own code in C#
This is a programming puzzle.
Write a program that can display its own code in a text box. This code should include everything in the Form1.cs file and doesn't need to include any other code such as the code in Form1.Designer.cs that creates the form's controls.There are at least three ways to do this. See how many you can find. (Hint: One uses only normal variables and code within the program with no weird tricks.) Over the years, I've done this in assembly language, Pascal, FORTRAN, C, C++, Delphi, Visual Basic, and C#. The key step is more or less the same in every language I've tried, at least using the "normal variables" approach. If you find a solution, zip it up and email it to me. To download Code Warrior's solution, which uses only program variables, click here. To download Corey Hull's solution, which reads the project file, click here.