开发者

F# - how do I index a collection (specifically the PropertyCollection)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜