I'm trying to wrap my mind around F# so I thought it would be fun to convert some simple C# code that I have that looks a user up in Active Directory using System.DirectoryServices namespace and returns a DirectoryEntry object. The part I'm struggling with is indexing the PropertyCollection that is contained in the DirectoryEntry.
In C# once I have the DirectoryEntry I can get 开发者_StackOverflowat properties in the PropertyCollection by doing this:
entry.Properties["displayName"].Value
I'm currently struggling with how to index the collection in F#. Can somebody shed some light on this?
You need to add a .
before the brackets.
entry.Properties.["displayName"].Value
Coming from a C++ / C# background I found the syntax is a bit odd at first but you get used to it.
精彩评论