如何在没有反射的情况下获取类中指定类型的所有属性

Meg*_*ind 2 c# oop reflection interface class

我有一个有很多属性的课程.他们中的大多数是自定义类型.我想得到所有这些属性,其接口类型相同.

Public class abc:IamLegend
{
    few properties
}

public class def:IamLegend
{
    few properties
}

public class on_which_iamworking
{
    public abc propabc{ get; set; }
    public def propdef{ get; set; }
    public someothertype propother{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我想要一些能够返回propabc和propdef的东西.

我知道如何使用反射来做到这一点,但我正在寻找另一种方式.

我正在研究c#4.0

谢谢

Dar*_*rov 7

我担心如果不使用反射,这在运行时是不可能的.这就是反射的目的.