How to write a quine while keeping the code DRY?

658 Views Asked by At

A quine is a program that prints its own source code without opening itself from the filesystem.

Here is an example of such a quine in C#:

class Q{static void Main(){var s="class Q{{static void Main(){{var s={1}{0}{1};System.Console.Write(s,s,'{1}');}}}}";System.Console.Write(s,s,'"');}}

This solution seems pretty messy and inelegant to me, though. It's a terrible program to maintain because whenever you change the source, you have to do it in two places, which is a big programming no-no.

Is there a good way to write a quine in C# that doesn't violate the DRY principle?

0

There are 0 best solutions below