mercredi 7 octobre 2015

Find all property references using reflection

Given a property

class Test
{
    private string name;
    public string Name
    {
        get { return name; }
        set { name = value;}
    }
}

Is there any way to use reflection to find all get/set references in an assembly? For example, if some test code were using this property as follows

class Client 
{
    private Test test = new Test();

    public string Name = test.Name;
}

Can reflection find that Client calls the get method on Test.Name? I could just open up my IDE and do a "find all references" but I'm wondering if this can be automated.





Aucun commentaire:

Enregistrer un commentaire