I have a method that lists the methods that a given object has, I want to take only the methods created by the user, in this case: Add and Subtract
What this method returns me:
GenericClass
publicclassGenerico{publicobjectObjeto{get;set;}publicstring[]ListarMetodos(){varm=Objeto.GetType().GetMethods();string[]metodos=newstring[m.Length];for(inti=0;i<m.Length;i++)metodos[i]=String.Concat(i," [+] ", m[i].Name, "\n");
return metodos;
}
}
Example Class
public class Calculadora
{
public int x { get; set; }
public int y { get; set; }
public Calculadora() { }
public int Somar()
{
return this.x + this.y;
}
public int Subtrair()
{
return this.x - this.y;
}
}