Linq projection with the extension method syntax - Digital Tool Factory blog Linq projection with the extension method syntax - Digital Tool Factory blog

Linq projection with the extension method syntax

I’ve looked this up an embarrassing number of times – here is how you do linq projection with the extension method syntax

List<TypeClassification> typeClassifications = ctx.Classes.Select(e => new TypeClassification() {Name = e.Name, TypeClassificationID = e.ClassificationID}).ToList();

Hopefully I shall remember.  I’m not sure why I can’t remember the exact syntax.

 

Written By Steve French

 

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.