考慮以下接口如何使用反射來獲取特定的接口類型的所有領域
public interface ISample
public interface ISample2 : ISample
public class A
{
[Field]
ISample SomeField {get; set;}
[Field]
ISample2 SomeOtherField {get; set; }
}
假設有不同的類,如A類和各種領域,如SomeField和SomeOtherField。 我怎樣才能得到所有這些字段其類型ISample或ISample(如ISample2)
這些都是字段。這些都是屬性。 –