星期四, 4月 08, 2010

透過屬性名稱 取得值


using System.Reflection;

object obj;
Type t = obj.GetType();
PropertyInfo pi = t.GetProperty("YourPropertyName");
object YourValue = pi.GetValue(obj,null)

沒有留言: