Class

MemberInfo


Description

MemberInfo is the super class for the AttributeInfo, ConstructorInfoInfo, MethodInfo, PropertyInfo, and TypeInfo classes in the Introspection system.

Properties

Name

Type

Read-Only

Shared

IsPrivate

Boolean

IsProtected

Boolean

IsPublic

Boolean

Name

String

Methods

Name

Parameters

Returns

Shared

GetAttributes

AttributeInfo()

Property descriptions


MemberInfo.IsPrivate

IsPrivate As Boolean

If True, the item has Private scope.

This property is read-only.

The following example checks the IsPrivate property before taking an action.

Var d As DateTime = DateTime.Now
For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
  If prop.IsPrivate Then
    ' take an action here..
  End If
Next

MemberInfo.IsProtected

IsProtected As Boolean

Is True, the item has Protected scope.

This property is read-only.

Var d As DateTime = DateTime.Now
For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
  If prop.IsProtected Then
    ' take an action here..
  End If
Next

MemberInfo.IsPublic

IsPublic As Boolean

If True, the item has Public scope.

This property is read-only.

This example checks the IsPublic property before taking an action.

Var d As DateTime = DateTime.Now
For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
  If prop.IsPublic Then
    ' take an action here..
  End If
Next

MemberInfo.Name

Name As String

The name of the item. This is only the class name. To get the full namespace path, use FullName instead.

This property is read-only.

This code gets the list of properties for the passed type instance.

Var d As DateTime = DateTime.Now
For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
  ListBox1.AddRow(prop.Name)
Next

Method descriptions


MemberInfo.GetAttributes

GetAttributes As AttributeInfo()

Returns an array of AttributeInfo objects.

The following gets the attributes of window1.

Var myAttributes() As Introspection.AttributeInfo = Introspection.GetType(Window1).GetAttributes

Sample code

The following reports the name of the class instance.

Var d As DateTime.Now
Var t As Introspection.TypeInfo = Introspection.GetType(d)
MessageBox("My class name is " + t.Name + ".")

The following gets the attributes of window1.

Var myAttributes() As Introspection.AttributeInfo= _
  Introspection.GetType(Window1).GetAttributes

Compatibility

All project types on all supported operating systems.