PropertyInfo::PropertyType Property
Gets the type of this property.
Assembly: mscorlib (in mscorlib.dll)
Implements
_PropertyInfo::PropertyTypeTo determine the type of a particular property, do the following:
Get a Type object that represents the type (the class or structure) that contains the property. If you are working with an object (an instance of a type), you can call its GetType method. Otherwise, you can use the C# operator or the Visual Basic operator, as the example illustrates.
Get a PropertyInfo object that represents the property in which you're interested. You can do this by getting an array of all properties from the Type::GetProperties method and then iterating the elements in the array, or you can retrieve the PropertyInfo object that represents the property directly by calling the Type::GetProperty method and specifying the property name.
Retrieve the value of the PropertyType property from the PropertyInfo object.
The following example defines an Employee class that has five properties. It then uses retrieves an array of PropertyInfo objects that represent those properties and displays the name and type of each.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1