反射命名空间是用 C# 编写 quine 的构建块吗?

发布于 2024-09-29 09:51:59 字数 220 浏览 0 评论 0原文

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

除了使用反射之外,我还应该考虑其他方法吗?

Do I need to use reflection to write a quine program for C#?
I read elsewhere - quine that opening the source file from disk is "cheating"
So I guess using .net reflector and/or opening the source file using System.IO is a hack.

Are there other ways other than using Reflection that I should be considering.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扬花落满肩 2024-10-06 09:51:59

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

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));          
    }   
} 

这里是另一个具有类似主题的堆栈溢出问题。
上面的 quine 来自此处

Actually you don't need reflection or anything else to make a quine, just a little string manipluation and some time.

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 is another stack overflow question with a similar theme.
The above quine is from here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文