2
可以說我有這樣的事情:如何獲取屬性樹的跟蹤?
class Program
{
static void Main(string[] args)
{
A A1 = new A();
A1.B1.C1.GetPath();
}
}
class A
{
public B B1 { get; set; }
public B B2 { get; set; }
}
class B
{
public C C1 { get; set; }
}
class C
{
public string GetPath();
}
是否有可能實現方法GetPath()
,這將返回例如「C1 in B1 in A1
」?
相關:http://stackoverflow.com/questions/5716896/get-inheritance-tree-of-type –