Created
June 7, 2014 17:14
-
-
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#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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