Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Reflection;
- namespace Recetas.Cap03
- {
- public class ClaseDemo
- {
- public void MetodoA() {}
- public void MetodoA(int i) {}
- public void MetodoB() {}
- public bool MetodoC(object[] o)
- {
- return true;
- }
- }
- public sealed class UsoGetMethods
- {
- public static void Main()
- {
- // Arreglo de elementos `MethodInfo`:
- MethodInfo[] metodos;
- // Obtención representación `Type` de `ClaseDemo`:
- metodos = typeof(ClaseDemo).GetMethods();
- // Resultado:
- Console.WriteLine ("Conjunto de métodos de `{0}`:\n", typeof(ClaseDemo).Name.ToString());
- foreach (MethodInfo metodo in metodos)
- {
- Console.WriteLine ("\tFirma método: {0}", metodo.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement