假设我有以下代码:
public abstract class MyBase
{
}
public class MyImplementation : MyBase
{
}
public class MyService1
{
MyImplementation myi = new MyImplementation();
}
public class MyService2
{
public void Foo()
{
MyImplementation myi = new MyImplementation();
}
}
是否可以使用 CQLinq 创建一个查询,该查询返回类继承自MyBase
并在某处创建的所有位置(或类型) new
?
查询应该返回MyService1
,MyService2
甚至更好MyService2.Foo()
到目前为止我所拥有的:
from x in Application.Types
where x.DeriveFrom("MyNamespace.MyBase")
select x