tags:

views:

992

answers:

3

Perhaps I'm missing something with the concept of Extension Methods, but I cannot gain access to the Extension Methods within the KeyCollection Class as defined here: http://msdn.microsoft.com/en-us/library/dk7e2d8e.aspx.

Using the following code excerpt:

   Dictionary<int, int> foo = new Dictionary<int,int>();
   foo.Add(1,1);
   Dictionary<int, int>.KeyCollection kc = foo.Keys;

I can only gain access to the "standard" KeyCollection methods (CopyTo, Equals, Finalize, etc) but cannot gain access to the extension methods (Aggregate, All, Any, etc).

Any help would be greatly appreciated! Thank you!

+8  A: 

I just tried it and it looks like I can.

You didn't forget

using System.Linq;

did you?

DrJokepu
+2  A: 

Are you missing the using System.Linq statement at the top of your class?

Ray Booysen
A: 

Thanks to both of you - I didn't realize the methods were defined outside of the System.Collections.Generic namespace. Thanks again!!

-Joel

Joel