Taha
Taha

Reputation: 87

Projections in LINQ to SQL

I have a challenge to use Select new

Normally we do

var record = from s in db.Settings
             select new
             {
                 myID = s.ID,
                 customName = s.PkGuid
             };

But we can't do Select new if I have like:

CacheHelper.Settings().Select(a => ???????)

Any one?!

Thanks :)

Upvotes: 0

Views: 91

Answers (1)

Arthur
Arthur

Reputation: 8129

You made me uncertain for 30ms!

var record = CacheHelper.Settings().Select(a => new {
             myID = a.ID,
             customName = a.PkGuid
         });

Upvotes: 1

Related Questions