using System;
namespace Csharp
{
class Program
{
static void Main(string[] args)
{
string s = Console.ReadLine();
Console.WriteLine(s);
Console.ReadKey();
}
}
}
using System;
namespace Csharp
{
class Program
{
static void Main(string[] args)
{
var caption = new { FirstName="James",MiddleName="T",LastName="Kirk"}; //匿名类型,使用var关键字
Console.WriteLine("FirstName:{0}\nMiddleName:{1}\nLastName:{2}",caption.FirstName,caption.MiddleName,caption.LastName);
Console.ReadKey();
}
}
}
using System;
namespace Csharp
{
//partial关键字允许把类、结构或接口放在多个文件中。
//文件1.cs
partial class Big
{
public void Method1()
{
Console.WriteLine("Call Method1");
}
}
//文件2.cs
partial class Big
{
public void Method2()
{
Console.WriteLine("Call Method2");
}
}
class Program
{
static void Main(string[] args)
{
Big b = new Big();
b.Method1();
b.Method2();
Console.ReadKey();
}
}
}
版权声明:本文为jkhere原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。