Monday, February 21, 2011

Enumerable LINQ extensions are hidden on strings... why and how ?

Possible Duplicate:
Why doesn’t VS 2008 display extension methods in Intellisense for String class

Hi all.

Yesterday I noticed that Enumerable LINQ exstensions are hidden on strings (I mean hidden from the intellisense).

We all know string is an IEnumerable<char>, so automatically it should get Enumerable extensions, and actually compiles and works if you use them, but why .NET developers decided to hide them from intellisense?

And lastly, how we can hide extension methods from a specific type ?

P.S. sorry for my poor english...

EDIT: I forgot to say I'm targeting .net 3.5 on VS 2008

EDIT2: Here 2 images of what happen:

Intellisense on string:

Intellisense on string

Intellisense on IEnumerable:

Intellisense on enumerable

From stackoverflow
  • Not on my copy of Visual Studio (that's 2010, with ReSharper installed):

    alt text

    Perhaps you forgot the using System.Linq; at the top? Or maybe ReSharper is adding them, not sure...

    digEmAll : I edited my question. I'm using VS2008 and I have "using System.Linq" at the top.

0 comments:

Post a Comment