2008年12月12日 星期五

Generic Type Casting

class c1
{
public Department Department{get;set;}
}

class c2:c1
{
public new Department Department{get;set;}
}

class Department
{
}

class Department : Department
{
}


在這個狀況下 Department 該如何轉型呢??


public new Department Department
{
get
{
Object temp = base.Department;
return temp as Department;
}
set { }
}

沒有留言: