反射命名空间是否是在C#中编写quine的构建块?

时间:2010-10-25 22:55:08

标签: c# system.reflection quine

我是否需要使用反射为C#编写quine程序? 我在其他地方读过 - quine从磁盘打开源文件是“作弊” 所以我想使用.net反射器和/或使用System.IO打开源文件是一个黑客。

除了使用我应该考虑使用的反射之外还有其他方法。

1 个答案:

答案 0 :(得分:2)

实际上你不需要反射或任何其他东西来制作一个quine,只需要一点点的字符串操作和一段时间。

using System;      
class Q      
{   
    static void Main()    
    {
        string s = "using System;class Q{2}static void Main(){2}string s ={1}{0}{1};
        Console.Write(string.Format(s, s, (char)34, (char)123, (char)125));{3}{3}";             
        Console.Write(string.Format(s, s, (char)34, (char)123, (char)125));          
    }   
} 

Here是另一个具有类似主题的堆栈溢出问题。 上述quine来自here