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!

FieldInfo.FieldType

Retrieves the Type of this field.

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

Property Value

Read-only. Retrieves the class of this field object.

Remarks

The Type is string, Boolean, Integer, and so on.

To get the FieldType property, first get the class Type. From the Type, get the FieldInfo. From the FieldInfo, get the FieldType value.

Example [C#]

[C#]

//Make a field
public class Myfield
{
   private string field = "private field";
   public string Field{
      get{return field;}
   }
}
public class Myfieldinfo
{
   public static int Main()
   {
      Console.WriteLine ("\nReflection.FieldInfo");
      Myfield Myfield = new Myfield();
 
      //Get the Type and FieldInfo
      Type MyType = Type.GetType("Myfield");
      FieldInfo Myfieldinfo = MyType.GetField("field", BindingFlags.NonPublic);
 
      //Get and Display the FieldType
      Console.Write ("\n{0}.", MyType.FullName);
      Console.Write ("{0} - ", Myfieldinfo.Name);
      Console.Write ("{0};", Myfield.Field);
      Console.Write ("\nFieldType = {0}", Myfieldinfo.FieldType);
 
      return 0;
   }
}

This code produces the following output:

Myfield.field- private field;

FieldType = System.String

See Also

FieldInfo Class | FieldInfo Members | System.Reflection Namespace | FieldAttributes