public class SampleClass
{
public string SampleMember {get;set;}
public void SampleMethod(string param1)
{
// Does something here.
}
}
The SampleClass above has two members, SampleMember (property) and SampleMethod. Now is there any way i can Retrieve list of methods,and classes that are Referencing my Method and my Sample Member in C# using Reflection?
using System;
using System.Reflection;
using System.Reflection.Emit;
Type myType =(typeof(SampleClass));
// Get the public methods.
MethodInfo[] myArrayMethodInfo = myType.GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly);
Console.WriteLine("\nThe number of public methods is {0}.", myArrayMethodInfo.Length);