JG Vimalan's Blog

It is all about coding!

Selecting specific fields in linq query

The following simple linq query shows how to select specific fields in a linq object,

            var employees = from emp in new DataClassesDataContext().Employees
                            select new {
                                emp.EmpId,
                                emp.FirstName,
                                emp.LastName }; 



the same logic can be applied when ‘join’ is used in linq.

Advertisements

October 15, 2010 - Posted by | Linq

2 Comments »

  1. […] This post was mentioned on Twitter by LINQ Feeds, LINQ Feeds. LINQ Feeds said: Selecting specific fields in linq query « JG Vimalan's Blog http://bit.ly/bwDZab […]

    Pingback by Tweets that mention Selecting specific fields in linq query « JG Vimalan's Blog -- Topsy.com | October 15, 2010 | Reply

  2. Hey! I would like to inform you that if I view this page on my iphone the page looks very weird. It’s very wide. I believe this is an easy fix. Otherwise great article! I’ve bookmarked this.

    Comment by Mature Women | November 11, 2010 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: