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 ( "\t Firma método: {0}" , metodo.ToString ( ) ) ;
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uUmVmbGVjdGlvbjsKCm5hbWVzcGFjZSBSZWNldGFzLkNhcDAzCnsKICAgIHB1YmxpYyBjbGFzcyBDbGFzZURlbW8KICAgIHsKICAgICAgICBwdWJsaWMgdm9pZCBNZXRvZG9BKCkge30KICAgICAgICBwdWJsaWMgdm9pZCBNZXRvZG9BKGludCBpKSB7fQogICAgICAgIHB1YmxpYyB2b2lkIE1ldG9kb0IoKSB7fQogICAgICAgIHB1YmxpYyBib29sIE1ldG9kb0Mob2JqZWN0W10gbykgCiAgICAgICAgeyAKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgfQogICAgCiAgICBwdWJsaWMgc2VhbGVkIGNsYXNzIFVzb0dldE1ldGhvZHMKICAgIHsKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCiAgICAgICAgewogICAgICAgICAgICAvLyBBcnJlZ2xvIGRlIGVsZW1lbnRvcyBgTWV0aG9kSW5mb2A6CiAgICAgICAgICAgIE1ldGhvZEluZm9bXSBtZXRvZG9zOwogICAgICAgICAgICAKICAgICAgICAgICAgLy8gT2J0ZW5jacOzbiByZXByZXNlbnRhY2nDs24gYFR5cGVgIGRlIGBDbGFzZURlbW9gOgogICAgICAgICAgICBtZXRvZG9zID0gdHlwZW9mKENsYXNlRGVtbykuR2V0TWV0aG9kcygpOwogICAgICAgICAgICAKICAgICAgICAgICAgLy8gUmVzdWx0YWRvOgogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSAoIkNvbmp1bnRvIGRlIG3DqXRvZG9zIGRlIGB7MH1gOlxuIiwgdHlwZW9mKENsYXNlRGVtbykuTmFtZS5Ub1N0cmluZygpKTsKICAgICAgICAgICAgZm9yZWFjaCAoTWV0aG9kSW5mbyBtZXRvZG8gaW4gbWV0b2RvcykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUgKCJcdEZpcm1hIG3DqXRvZG86IHswfSIsIG1ldG9kby5Ub1N0cmluZygpKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfQ==