标题挺别扭的,至少我对这些高级技术了解的还很少,继续学习吧...初次接触匿名类感觉很爽,简化了代码量(可能有些时候还真需要它)
控制台的代码
using System.Collections.Generic;using System.Linq;
using System.Text;
using System.Reflection;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Thread t = new Thread(new ParameterizedThreadStart(SayHolle));
t.Start(new { Name = "Seven", Age = 24 });
}
static public void SayHolle(Object o)
{
Console.WriteLine("Hello! My Name is {0} and My age is {1}",
o.GetType().GetProperty("Name").GetValue(o,null),
o.GetType().GetProperty("Age").GetValue(o,null));
}
}
}