简体   繁体   中英

Missing Dictionary<TKey,TValue>.KeyCollection Extension Methods .NET 3.5 (C#)

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!

I just tried it and it looks like I can.

You didn't forget

using System.Linq;

did you?

您是否错过了在课程顶部using System.Linq语句?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM