using System;
namespace ConsoleApplication5
{
class HelloWorld
{
private string OutPut;
public HelloWorld(string OutWord)
{
OutPut=OutWord;
Console.WriteLine(OutPut);
}
}
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
HelloWorld h=new HelloWorld("HelloWorld!");
// TODO: 在此处添加代码以启动应用程序
//
}
}
}
此博客展示了一段C#代码,定义了一个HelloWorld类,在构造函数中接收字符串并输出。在Main方法里创建HelloWorld类的实例,传入'HelloWorld!'并输出,实现基本的输出功能。

被折叠的 条评论
为什么被折叠?



