using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Person p = new Person();
//链式编程
p.Sayhi().Hello();
Console.ReadKey();
}
}
class Person
{
public int Age { get; set; }
public string Name { get; set; }
public Person Sayhi()
{
Console.WriteLine(
"hhaha");
//链式编程的关键:执行方法之后,返回当前对象.
return this;
}
public Person Hello()
{
Console.WriteLine(
"hello");
return this;
}
}
}