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!

MemberAttributeCollection.Item (Type)

Gets the attribute with the specified type.

[C#] In C#, this member is the indexer for the MemberAttributeCollection class.

[Visual Basic]
Overloads Overridable Public Default ReadOnly Property Item( _
   ByVal attributeType As Type _
) As MemberAttribute
[C#]
public MemberAttribute this[
   Type attributeType
] {virtual get;}
[C++]
public: __property virtual MemberAttribute* get_Item(
   Type* attributeType
);
[JScript]
returnValue = MemberAttributeCollectionObject.Item(attributeType);
-or-
returnValue = MemberAttributeCollectionObject(attributeType);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.

Arguments [JScript]

attributeType
The type of the MemberAttribute to get from the collection.

Parameters [Visual Basic, C#, C++]

attributeType
The type of the MemberAttribute to get from the collection.

Property Value

The MemberAttribute with the specified type, or if the attribute does not exist, the default value for the attributeType.

Remarks

If the attribute does not exist in the collection, this property returns the default value for the attributeType.

Example [Visual Basic]

The following example gets the DescriptionAttribute from the collection and prints its value. It assumes that Button1 has been instantiated on a form.

[Visual Basic]

Private Sub PrintIndexItem2()
   'Create a new collection and assign it the attributes for Button1.
   Dim attributes As MemberAttributeCollection
   attributes = TypeDescriptor.GetAttributes(Button1)

   'Get the description attribute from the collection.
   Dim myDescription As DescriptionAttribute
   myDescription = CType(attributes.Item(GetType(System.ComponentModel.DescriptionAttribute)), DescriptionAttribute)

   'Print the value of the attribute in a text box.
   TextBox1.Text = myDescription.GetDescription
End Sub

See Also

MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Item Overload List | MemberAttribute