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,开发者_Go百科 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 http://img690.imageshack.us/img690/10/stringintelli.png
Intellisense on IEnumerable:
Not on my copy of Visual Studio (that's 2010, with ReSharper installed):
alt text http://codeka.com/tmp/string-enumerable.png
Perhaps you forgot the using System.Linq;
at the top? Or maybe ReSharper is adding them, not sure...
When I have a string s
and type s.
I do get all the extensions methods (like FirstOrDefault etc).
I checked with VS2010 Express.
You should of course have the static class System.Linq.Enumerable
in scope.
As for the How part, I guess that something like this attribute was used on String. But clearing the "Hide advanced" option for C# brought no change, so it is not exactly this attribute but something similar.
As for the Why part, no idea. But interesting that it was changed for Fx4
精彩评论