mercredi 28 octobre 2015

How can I use Reflection to get all fields of particular interface type

Consider following interfaces

public interface ISample 
public interface ISample2 : ISample

public class A
{
    [Field]
    ISample SomeField {get; set;}

    [Field]
    ISample2 SomeOtherField {get; set; }
}

Suppose there are various classes like class A and various Fields like SomeField and SomeOtherField. How can I get a list of all such Fields which are of type ISample or other interfaces derived from ISample (like ISample2)





Aucun commentaire:

Enregistrer un commentaire