0
votes

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

In C# 2.0

IComparer

IEqualityComparer

IEnumerator

IEnumerable

ICollection

IDictionary

IDictionaryEnumerator

IList.

5

5 Answers

5
votes

.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)

3
votes

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).

3
votes

(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.

1
votes

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
            }
         };