program.cs
来自「csharp课本的源代码」· CS 代码 · 共 45 行
CS
45 行
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplicationExample
{
class Program
{
static void Main(string[] args)
{
int i = 1;
Console.WriteLine("The first is:{0}", i);
Console.Write("Please enter your name: ");
string strName = Console.ReadLine();
Console.WriteLine("Hello " + strName + "!");
HelloName helloName = new HelloName();
HelloMe helloMe = new HelloMe();
helloMe.Welcome();
Console.ReadLine();
}
}
class HelloName
{
private string s = "张三";
private int i = 5;
public HelloName()
{
Console.WriteLine("hello {0},I have {1} books!", s, i);
}
}
class HelloMe
{
private string s = "王五";
private int i = 10;
public HelloMe()
{
Console.WriteLine("hello {0},I have {1} books!", s, i);
}
public void Welcome()
{
i = 11;
Console.WriteLine("hi I have {0} books,Welcome to using C#.NET!", i);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?