Cloud and Microsoft technologies enthusiast architect in Switzerland RSS 2.0
# Thursday, April 06, 2006

Session D308 – LINQ

Probably the most advanced session of the day…

The problem we face every day is to transform relational data into hierarchical objects and that is why O/R mapper exists such as Nhibernate for instance. The representation of these two models is totally different. But, retrieving objects with a query like we do in traditional databases would be really nice. One of the answers could be LINK, a language agnostic concept to query not only data, but objects as well. More precisely, to query collections of objects. LINQ  means Language Integrated Query. Take for example the following statement :

var c = from Customers

            where c.City == ‘London’

            select c.Name

Var is then a new data type which is completely different from the object type. It is a location to store a projection which is, in fact, the result of a query. If you open an assembly containing such code with ILDASM, you will see that c is translated to a projection class. From this c variable, it is possible to cycle through it to display its properties. The most efficient way to do it is to avoid the use of the foreach loop statement. Indeed, this instruction is transformed to a bunch of code included in a try/catch block which is really a performance killer. That means if you want to optimize your code for speed, look at your loop statements and replace your foreach loops by a standard for(int i = 0; i < c.Length; i++). The speed will increase by a factor of 10.

Thursday, April 06, 2006 10:40:07 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] -
English | TechDays | Technical
All comments require the approval of the site owner before being displayed.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview
Google Cloud Platform Certified Professional Cloud Architect
Ranked #1 as
French-speaking SharePoint
Community Influencer 2013
Navigation
Currently Reading :
I was there :
I was there :
I was exhibiting at :
I was there :
I was a speaker at :
I was a speaker at :
I was a speaker at
(January 2013 session):
I was a speaker at :
I was a speaker at :
United Nations (UN) SharePoint Event 2011
I was a speaker at :
I was there !
I was there !
I was there !
I was there !
Archive
<August 2020>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
303112345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2020
Yves Peneveyre
Sign In
Statistics
Total Posts: 289
This Year: 1
This Month: 0
This Week: 0
Comments: 19
Themes
Pick a theme:
All Content © 2020, Yves Peneveyre
DasBlog theme 'Business' created by Christoph De Baene (delarou)