Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Standard Query Operators

Standard Query Operators

Ratings: (0)|Views: 66 |Likes:
Published by Sreenivasarao

More info:

Published by: Sreenivasarao on Aug 27, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/12/2012

pdf

text

original

 
Chapter 0 The .NET
The .NETStandard Query Operators
Anders Hejlsberg , Mads TorgersenMicrosoft CorporationApril 2007Applies to:Microsoft
®
Visual Studio
®
Code Name "Orcas"Microsoft
®
.Net Framework 3.5
Table of Contents
The .NET............................................................................................................1Standard Query Operators................................................................................1Technical Specification......................................................................................3
The Func delegate types..................................................................................4The Enumerable class.....................................................................................5Restriction operators.......................................................................................5Where.....................................................................................................................5Projection operators.......................................................................................6Select.....................................................................................................................6SelectMany..............................................................................................................7Partitioning operators......................................................................................9Take.......................................................................................................................9Skip......................................................................................................................10TakeWhile..............................................................................................................10SkipWhile..............................................................................................................11Join operators..............................................................................................12Join.......................................................................................................................12GroupJoin..............................................................................................................13Concatenation operator.................................................................................15Concat..................................................................................................................15Ordering operators.......................................................................................16OrderBy / ThenBy...................................................................................................16Reverse.................................................................................................................19
 
Chapter 0 The .NET
Grouping operators.......................................................................................19GroupBy................................................................................................................19Set operators...............................................................................................21Distinct.................................................................................................................21Union....................................................................................................................21Intersect...............................................................................................................22Except...................................................................................................................22Conversion operators....................................................................................23AsEnumerable........................................................................................................23ToArray.................................................................................................................24ToList....................................................................................................................24ToDictionary...........................................................................................................25ToLookup...............................................................................................................26OfType..................................................................................................................27Cast......................................................................................................................28Equality operator..........................................................................................28SequenceEqual.......................................................................................................28Element operators........................................................................................29First......................................................................................................................29FirstOrDefault........................................................................................................30Last......................................................................................................................30LastOrDefault.........................................................................................................30Single...................................................................................................................31SingleOrDefault......................................................................................................31ElementAt..............................................................................................................32ElementAtOrDefault................................................................................................32DefaultIfEmpty.......................................................................................................33Generation operators....................................................................................33Range...................................................................................................................33Repeat..................................................................................................................34Empty...................................................................................................................34Quantifiers...................................................................................................35Any.......................................................................................................................35All.........................................................................................................................35
 
Chapter 0 The .NET
Contains................................................................................................................36Aggregate operators.....................................................................................36Count....................................................................................................................36LongCount.............................................................................................................37Sum......................................................................................................................37Min.......................................................................................................................38Max......................................................................................................................39Average.................................................................................................................40Aggregate..............................................................................................................41
Technical Specification
The
Standard Query Operators
is an API that enables querying of any .NET array or collection.The Standard Query Operators API consists of the methods declared in the
System.Query.Enumerable
static class in the assembly named System.Core.dll.The Standard Query Operators API complies with the .NET 2.0 Common Language Specification(CLS) and is usable with any .NET language that supports generics. While not required, theexperience of using the Standard Query Operators is significantly enhanced with languages thatsupport extension methods, lambda expressions, and native query syntax. The future releases of C# 3.0 and Visual Basic 9.0 will include these features.The Standard Query Operators operate on
sequences
. Any object that implements the interface
IEnumerable<T>
for some type
T
is considered a sequence of that type.The examples shown in this specification are all written in C# 3.0 and assume that the StandardQuery Operators have been imported with the using clause:
usingSystem.Linq;
The examples refer to the following classes:
public classCustomer { public intCustomerID;  public stringName;  public stringAddress;  public stringCity;  public stringRegion;  public stringPostalCode;  public stringCountry;

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->