views:

184

answers:

5

What are the new collection interfaces available in C# 3.0 ?

In C# 2.0

IComparer

IEqualityComparer

IEnumerator

IEnumerable

ICollection

IDictionary

IDictionaryEnumerator

IList.

+1  A: 

As far as I can tell, there's nothing new in 3.0 when it comes to collection interface.

.NET 3.0 (not just C#) have new Collection Initializers:

List<Class1> someClasses = new List<Class1>
         {
            new Class1
            {
               Prop1 = "abc",
               Prop2 = 123
            },
            new Class1
            {
               Prop1 = "xyz",
               Prop2 = 789
            }
         };
o.k.w
+3  A: 

(Collection) interfaces are defined in the .Net class libraries, not in the C# language.

And in .Net 2.0 your list is missing all the generic interfaces. In .Net 3.0 there weren't any new.

Foxfire
+3  A: 

No new interfaces AFAIK, but in the .NET Framework 3.5 (C# 3) you get the new HashSet<T> collection class which implements a set (in the System.Core assembly).

Lucero
+2  A: 

You can compare collection interfaces available in C# 2.0 with collection interfaces available in C# 3.0

no new interface.

Anwar Chandra
Those are .NET versions, not C# versions - and .NET 3.5 introduced a few...
Marc Gravell
...and those links only show the non-generic collections, which were in fact already there in .NET 1...
Lucero
+4  A: 

.NET 3.5 (commonly confused with C# 3.0, although they are completely separate) introduced:

  • IGrouping<TKey,TValue>
  • ILookup<TKey,TValue>
  • IOrderedEnumerable<T>
  • IOrderedQueryable
  • IOrderedQueryable<T>
  • IQueryable
  • IQueryable<T>
  • IQueryProvider

and concrete types:

  • HashSet<T>
  • Lookup<TKey,TValue>

(and a load of private stuff, but those are the main public ones)

Marc Gravell
...but except for the `HashSet<T>` those are types used for LINQ. Just to be exact. ;)
Lucero