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.MemberType

Retrieves the Type of property reflected by this FieldInfo object. The retrieved value indicates that this member is a field.

[Visual Basic]
Overridable Public ReadOnly Property MemberType As MemberTypes
[C#]
public MemberTypes MemberType {override get;}
[C++]
public: __property virtual MemberTypes get_MemberType();
[JScript]
public function get MemberType() : MemberTypes;

Property Value

Read-only. Returns MemberTypes.Field.

Remarks

This is used when this field is being tested as generic member.

Example [C#]

[C#]

//Make a field
public class Myfield
{
   private string field = "a 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 MemberType
      Console.Write ("\n{0}.", MyType.FullName);
      Console.Write ("{0} - ", Myfieldinfo.Name);
      Console.Write ("{0};", Myfield.Field);
 
      MemberTypes Mymembertypes = Myfieldinfo.MemberType;
      Console.Write(" MemberType is a {0}",
         EnumInfo.ToString(typeof(MemberTypes), Mymembertypes));
 
      return 0;
   }
}

This code produces the following output:

Reflection.FieldInfo

Myfield.field- a private field; MemberType is a Field

See Also

FieldInfo Class | FieldInfo Members | System.Reflection Namespace