Advertisement
Fhernd

UsoGetProperties.cs

Aug 29th, 2014
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Reflection;
  3.  
  4. namespace Recetas.Cap03
  5. {
  6.     public sealed class UsoGetProperties
  7.     {
  8.         public static void Main()
  9.         {
  10.             // Arreglo con elementos `PropertyInfo`:
  11.             PropertyInfo[] propiedades;
  12.            
  13.             // Obtiene las propiedades de `Type`:
  14.             propiedades = Type.GetType("System.Type").GetProperties();
  15.            
  16.             // Resultado:
  17.             Console.WriteLine ("\nPropiedades de `{0}`:\n", Type.GetType("System.Type").Name.ToString());
  18.             foreach (PropertyInfo propiedad in propiedades)
  19.             {
  20.                 Console.WriteLine ("\tPropiedad: {0}", propiedad.ToString());
  21.             }
  22.            
  23.             Console.WriteLine ();
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement