Gets the attribute with the specified index
number.
[C#] In C#, this member is the indexer for the MemberAttributeCollection class.
[Visual Basic] Overloads Overridable Public Default ReadOnly Property Item( _ ByVal index As Integer _ ) As MemberAttribute [C#] public MemberAttribute this[ int index ] {virtual get;} [C++] public: __property virtual MemberAttribute* get_Item( int index ); [JScript] returnValue = MemberAttributeCollectionObject.Item(index); -or- returnValue = MemberAttributeCollectionObject(index);
[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.
The MemberAttribute with the specified index number.
The index number is zero-based. Therefore, you must subtract one from the numerical position of a particular MemberAttribute to access that MemberAttribute. For example, to get the third MemberAttribute, you need to specify Item property (MemberAttributeCollection indexer)(2).
The following example uses the Item property (MemberAttributeCollection indexer) to print the name of the MemberAttribute specified by the index number in a text box. Since the index number is zero-based, this example prints the name of the second MemberAttribute in a text box. It assumes Button1 has been instantiated on a form.
[Visual Basic]
Private Sub PrintIndexItem() 'Create a new collection and assign it the attributes for Button1. Dim attributes As MemberAttributeCollection attributes = TypeDescriptor.GetAttributes(Button1) 'Print the second attribute's name. TextBox1.Text = attributes.Item(1).ToString End Sub
MemberAttributeCollection Class | MemberAttributeCollection Members | System.ComponentModel Namespace | MemberAttributeCollection.Item Overload List | MemberAttribute