简体   繁体   English

如何在 C# 中编译 C# 程序

[英]How to compile a C# programm in C#

How i can make something like a "builder" for my application.我如何为我的应用程序制作类似“构建器”的东西。 Let me explain it in a example:让我用一个例子来解释它:

application.exe应用程序

System.Console;

private class Program
{
    public static void Main()
    {    
        WriteLine(message);
    }
}

Now i want to have another C# program that is able to compile this program but change the string message to what the user desires.现在我想要另一个 C# 程序,它能够编译这个程序,但将字符串消息更改为用户想要的。

i hope you can understand what i mean with my bad English and bad explanation skills.我希望你能用我糟糕的英语和糟糕的解释能力理解我的意思。

 class Program
{
    static void Main(string[] args)
    {
        if (args.Length >0)
        {
            Console.WriteLine(args[0].ToString());
            Console.ReadKey();
        }
    }
}

Complile the Program and execute it using cmd prompt with any string you want as parameter.编译程序并使用 cmd 提示符以您想要的任何字符串作为参数执行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM