LDAP Client.Net

AttributeCollection.Item Property (String)

Attribute in this collection.

[C#] In C#, this property is the indexer for the AttributeCollection class.

[Visual Basic]
MustOverride  OverloadsPublic Default Property ReadOnly Item( _ 
   ByVal index As String _ 
) As Attribute
[C#]
public abstract Attribute this[
   string index
] { get; }
[C++]
public: abstract __property Attribute* get_Item(
   String* index
);
[JScript]
returnValue = AttributeCollectionObject.Item( index );
-or-
returnValue = AttributeCollectionObject( 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 property whose type is Object and whose index type is String.

Example

[C#]
using System;
using LdapServices.Ldap;

namespace LDAPSampleCodeConsole
{
class SampleApp
{
static void Main(string[] args)
{
Client client = new Client();

// Connect to the directory
client.Connect("directory.yourServer.ca");
// Search the directory for entries with surname starting with 'Ab'
EntryCollection entries = client.Search("o=yourCompany,c=ca", "sn=Ab*");

// Access an attribute in this collection by attribute name
AttributeCollection attributes = entries[0].Attributes;
LdapServices.Ldap.Attribute attribute = entries[0].Attributes["sn"];
Console.WriteLine("Attribute Value: " + attribute.Values[0].StringValue);

client.Disconnect();
}
}
}

See Also

AttributeCollection Class | LdapServices.Ldap Namespace | AttributeCollection.Item Overload List