Class

# AttributeInfo

<div class="rst-class">

forsearch

</div>

Introspection

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Provides information on the attributes of an item via the `Introspection</api/language/introspection/introspection>` system. Attributes are added to project items using the Inspector.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                         | Type                               | Read-Only | Shared |
|------------------------------|------------------------------------|-----------|--------|
| `Name<attributeinfo.name>`   | `String</api/data_types/string>`   | ✓         |        |
| `Value<attributeinfo.value>` | `Variant</api/data_types/variant>` | ✓         |        |

## Property descriptions

<div id="attributeinfo.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AttributeInfo.Name

**Name** As `String</api/data_types/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.
>
> ``` xojo
> Var d As DateTime = DateTime.Now
>
> For Each prop As Introspection.PropertyInfo In Introspection.GetType(d).GetProperties
>   ListBox1.AddRow(prop.Name)
> Next
> ```

<div id="attributeinfo.value">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

AttributeInfo.Value

**Value** As `Variant</api/data_types/variant>`

> The optional value of the attribute.
>
> This property is read-only.

## Notes

For attributes of classes, attributes are inherited from the parent class and attribute values are overridden if redefined by the subclass.

Add attributes to project items, methods, properties, constants, etc. by using the "Advanced" tab on the Inspector.

## Sample code

Suppose Window1 has three attributes: The first attribute contains the Name only and the others have both a Name and Value:

| Name    | Value |
|---------|-------|
| myName1 |       |
| myName2 | "Foo" |
| myName3 | 23    |

The following code retrieves the attributes and displays them in a `ListBox</api/user_interface/desktop/desktoplistbox>`:

``` xojo
For Each attribute As Introspection.AttributeInfo In Introspection.GetType(window1).GetAttributes
  ListBox1.AddRow(attribute.Name)
  If attribute.Value.IsNull Then
    ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,1) = "No Value"
  Else
    ListBox1.CellTextAt(ListBox1.LastAddedRowIndex,1) = attribute.Value
  End If
Next
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `ConstructorInfo</api/language/introspection/constructorinfo>`, `MemberInfo</api/language/introspection/memberinfo>`, `MethodInfo</api/language/introspection/methodinfo>`, `ObjectIterator</api/language/introspection/objectiterator>`, `ParameterInfo</api/language/introspection/parameterinfo>`, `PropertyInfo</api/language/introspection/propertyinfo>`, `TypeInfo</api/language/introspection/typeinfo>` classes; `Introspection</api/language/introspection/introspection>` module; `GetTypeInfo</api/language/introspection/gettypeinfo>` function; `Introspection</api/language/introspection/introspection>` namespace

</div>
