PropertyInfo.PropertyType Property

Gets the type of this property.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public abstract Type PropertyType { get; }

Property Value

Type: System.Type
The type of this property.

The Type is String, Boolean, Int32, and so on.

To get the PropertyType property, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, get the PropertyType value.

The following example displays the type of a property.

using System;
using System.Reflection;

public class Example
    public int Answer
            return 42;

    public static void Demo(System.Windows.Controls.TextBlock outputBlock)
        // Get a Type object for the Example type.
        Type t = typeof(Example);

        // Get a PropertyInfo object for the Answer property.
        PropertyInfo pi = t.GetProperty("Answer");

        // Display the type returned by the Answer property.
        outputBlock.Text += String.Format("The return type of the {0}.{1} property is {2}.",
             t.Name, pi.Name, pi.PropertyType) + "\n";

/* This example produces the following output:

The return type of the Example.Answer property is System.Int32.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions