NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

PropertyInfo.PropertyType

Retrieves the type of the field of this property.

[Visual Basic]
MustOverride Public ReadOnly Property PropertyType As Type
[C#]
public Type PropertyType {abstract get;}
[C++]
public: __property virtual Type* get_PropertyType() = 0;
[JScript]
public abstract function get PropertyType() : Type;

Property Value

Read-only. The Type of this property.

Remarks

The Type is string, Boolean, Integer, etc.

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

Example [C#]

[C#]

class Mypropertyinfo
{
   public static int Main()
   {
      Console.WriteLine("\nReflection.PropertyInfo");
 
      //Get the type and PropertyInfo
      Type MyTypea = Type.GetType("System.Reflection.MemberInfo");
      PropertyInfo Mypropertyinfoa = MyTypea.GetProperty("Name");
      Type MyTypeb = Type.GetType("System.Reflection.MethodBase");
      PropertyInfo Mypropertyinfob = MyTypeb.GetProperty("IsFinal");
 
      //Read and display the PropertyType property
      Console.Write ("\n" + MyTypea.FullName + "." + Mypropertyinfoa.Name + " has a PropertyType of " + Mypropertyinfoa.PropertyType);
      Console.Write("\n" + MyTypeb.FullName + "." + Mypropertyinfob.Name + " has a PropertyType of " + Mypropertyinfob.PropertyType);
 
      return 0;
   }
}
Produces the following output

Reflection.PropertyInfo
System.Reflection.MemberInfo.Name has a PropertyType of System.String
System.Reflection.MethodBase.IsFinal has a PropertyType of Boolean

See Also

PropertyInfo Class | PropertyInfo Members | System.Reflection Namespace