I am using the LDAP connection class, working from this page on MSDN.
I have instantiated the class using the string constructor like so:
LdapConnection ld = new LdapConnection("LDAP://8.8.8.8:8888");
I now want to set my credentials so I am trying to do the following:
ld.Credential.UserName = "Foo";
But I get the following error:
The property or indexer ‘System.DirectoryServices.Protocols.DirectoryConnection.Credential’ cannot be used in this context because it lacks the get accessor.
However, when typing this, intellisense shows the following:

This description suggests that UserName should indeed have a Get Accessor, what am I missing?
Thanks
The LdapConnection.Credential Property doesn’t have a
getaccessor, so you can’t retrieve its current value and set theUserNameproperty on the returned NetworkCredential instance. You can only assign to the LdapConnection.Credential Property:or
or