Tech Off Post

Single Post Permalink

View Thread: How about some syntax sugar for IEnumerable<>?
  • User profile image

    1.  There's other "readonly collection" types.  ReadOnlyCollection<T> for instance.  It's not always appropriate to expose IEnumerable only because you want a "readonly collection" type.

    2.  IEnumerable<Foo> isn't the ugly syntax you want to make it out to be.  Foo* or Foo+ may be shorter, but they are also less meaningful.  I think it was at least a little questionable that we added the Foo? syntax, when this is nothing but sugar for Nullable<Foo>.  My gut tells me it's even more questionable to do the same in this case.  Obviously that's only an opinion.