Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 7, 2014 17:14
Show Gist options
  • Save Fhernd/6d3f4c342d0dcd9ddae9 to your computer and use it in GitHub Desktop.
Save Fhernd/6d3f4c342d0dcd9ddae9 to your computer and use it in GitHub Desktop.
Demostración del uso del método GetProperties de la clase Type en C#.
using System;
using System.Reflection;
namespace Recetas.Cap03
{
public sealed class UsoGetProperties
{
public static void Main()
{
// Arreglo con elementos `PropertyInfo`:
PropertyInfo[] propiedades;
// Obtiene las propiedades de `Type`:
propiedades = Type.GetType("System.Type").GetProperties();
// Resultado:
Console.WriteLine ("\nPropiedades de `{0}`:\n", Type.GetType("System.Type").Name.ToString());
foreach (PropertyInfo propiedad in propiedades)
{
Console.WriteLine ("\tPropiedad: {0}", propiedad.ToString());
}
Console.WriteLine ();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment