What happend to my Intellisense??
When I type a line like this …
Dim users = (From u In Membership.GetAllUsers Select u.UserName)
… I get (almost) no Intellisense when I get to the Select u. part. Only Equals, GetHashCode, GetType, ReferenceEquals and ToString appears. Not “UserName” and the other relevant propeties of the MembershipUser class.
The code compiles and works just fine.
Any suggestions?
I tried devenv.exe /ResetSettings from the VS Command prompt as suggested in this question, but it didn’t help.
The reason why this is happening is because the return type of
MemberShip.GetAllUsersisMembershipUserCollection. This collection type only implementsIEnumerableand is not strongly type. The compiler can only infer the type of the elements in the collection isObject. Hence you get intellisense forObjectin the select clause.You need to tell the compiler more information about the type of the elements. For instance if you know all of the values are
MembershipUserinstances you could use the Cast function to tell the compiler