PropertyInfo.PropertyType Property
.NET Framework 3.0
Gets the type of this property.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly: mscorlib (in mscorlib.dll)
The following example displays the data type of the specified property.
using System; using System.Reflection; namespace MyNamespace { public class Example { public int Answer { get { return 42; } } public static void Main() { // Get a Type object for the Example type. Type t = typeof(MyNamespace.Example); // Get a PropertyInfo object for the Answer property. PropertyInfo pi = t.GetProperty("Answer"); // Display the type returned by the Answer property. Console.WriteLine("The return type of the {0}.{1} property is {2}.", t.Name, pi.Name, pi.PropertyType); } } }
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.