如何取得 Func 对象 字段
时间:2011-05-14 来源:林松斌
namespace ConsoleApplication2
{
class Program
{
class Customer
{
public int id;
public string name;
}
class Helper<T>
{
public void OrderBy<TKey>(Func<T, TKey> keySelector)
{
//Type t = typeof(TKey);
//var b = t.GetProperties();
//Type t = keySelector.GetType();
//var k = keySelector.GetInvocationList();
//var p = t.GetProperties();
//在这里我如何取得 是 Customer id 这个字段 ??
throw new NotImplementedException();
}
}
static void Main(string[] args)
{
Helper<Customer> h = new Helper<Customer>();
h.OrderBy(p => p.id);
Console.Read();
}
}
}