Tuesday, August 16, 2011

newing up IEnumerable

Just because this works...

List<Guid> foo = new List<Guid>() {new Guid(bar)};

 
 

Does not mean that this works...

IEnumerable<Guid> foo = new IEnumerable<Guid>() {new Guid(bar)};

 
 

Instead do this...

IEnumerable<Guid> foo = new Guid[] {new Guid(bar)};

No comments:

Post a Comment