Hello world.

随笔 - 152  文章 - 1  评论eraB有着十年经验nbsp; 文章 - 1&t文章 - .. g -f"> Ryan's ">nbsp; nbsp; t - 1&traBEmyhomntitle" hrmenucnblogs.com/flysnow-z/">Ryan's Housenbsp; nbsp; t - 1&traBEndth=w.cntle" hrmenucnref="nofoBegwcnblogs.com/sflyiw-z/">Ryan's ://wP=w.s.aspx?optmic>新 文e=a>nbsp; nbsp; t - 1&traBEce-wac.cnacc inkey="9cntle" hrmenucnref="nofoBegwcnblogs.com/sflymsg/jquery.js" tyend/联系e=a>nbsp; nbsp; t - 1&traBEadmartntle" hrmenucnref="nofoBegwcnblogs.com/sflyiw-z/">Ryan's ">管理e=a>nbsp; nbsp; t - 1&traBE="RSitle" hrmenucnblogs.com/flysnow-z/">Ryan's House<="RS>订阅e=a>nbsp; t - 1&traBE="R_imEndcnblogs.com/flysnow-z/">Ryan's House<="RS>Ryan's imEnds/="/.gifcnalth,订阅c Exr> &t文章 /script> egiic
随笔h=w.cderDis">我一h=w.rmaint章 /h1>t - alsh=w._/www._url"我一h=w.rmain2cnblogs.com/flysnow-z/">Ryan's House &h1>v class="
Rysh=w._">

span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s and Queries in LINQ - Ryan.zhu - 博ro:p &o:p &span &h1>v Ric. The博客infrastruct5Sy suph=des simil 'flapa3Zjspan 一CodeFragmen.cdS em.Linq.ries in LIN &span &span --Pagspace.eries in LI t: 7s areian fesropriww. abstract" r for a ; eiwidds theorei客API with that lapa3Zjxmledd- thespan 一SpeBeE"> and Qu0xF &span -source fZj_Q - RsrovideF &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span tle" hrGramE"> and Qu &span -parsing of skrings toRsroduce eies in LI t: 7s (thetblogs.#_The_Peta Lambda_Methods">span 一SpeBeE">Peta Lambda &span & - Rtblogs.#_The_Peta _Method">Peta & methods), &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span and Quecreat" r of “ ata C一hu” (thetblogs.#_ and Qu_C一_Creat" r">span 一SpeBeE">CreateC一 &span & methods), - &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span tle" hrGramE"> and Qu &span -skring-baseddt/javing through 客sroviders (thetblogs.#_Iyan.yvar iEiwidn LI_Methods">Iyan.yvar eiwidn LI methods & ). &p>v eies in LI languEnd & for formulat"ng eies in LINQ - Rqan.zhu - skrings. &p>v

t-PageB_ and Qu_ries in LI_API"sr> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s and Queries in LI APIro:p &o:p &span &h1>v > The and Queries in LI APIdis brought - toRscope by using (imp=deing)thespan 一SpeBeE">span 一CodeFragmen.cdS em.Linq. and Qu &span &span --Pagspace.eBeegwdis an exampleof festying the and Queries in LI APIdtoRa 客toRSQL data source. &p>v span 一SpeBeE"> span tle" hrGramE"> span skinshrcolor: bluep = ' &span &span &span -t/jav =
db.Customnr &span .
Where( &span span skinshrcolor: #a31515">"COrders.Count &span ->= @1" &span , span skinshrcolor: #a31515">"Lond r" &span , 10).
span tle" hrGramE">OrderBy &span &span span tle" hrGramE">( &span span skinshrcolor: #a31515">"span 一SpeBeE">CompanyNPag &span " &span ).
Select( &span span skinshrcolor: #a31515">"new(span 一SpeBeE">CompanyNPag &span au NPag, Phone)" &span ); &p>v v

Peta Lambda &span Methodsro:p &o:p &span &h2>v span 一CodeFragmen.cdS em.Linq. and Qu. and Quries in LI &span &span -一 defhees thefoBegwing overloade Rspan 一SpeBeE">span 一CodeFragmen.cdPeta Lambda &span &span -methods for dand Qualfy parsing - Rcreat"ng lambda eies in LIN. &p>v t-PageBPeta Lambda1"sr> span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > span skinshrcolor: #2b91af">Lambdaries in LI &span &span -span 一SpeBeE">Peta Lambda &span (
span skinshrcolor: #2b91af">Parameterries in LI &span &span [] parameters, span skinshrcolor: #2b91af">Type &span -span 一SpeBeE">s iultType &span ,
ring &span -eies in LI, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v t-PageBPeta Lambda2"sr> span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > span skinshrcolor: #2b91af">Lambdaries in LI &span &span -span 一SpeBeE">Peta Lambda &span (
Type &span -span 一SpeBeE">argumen.Type &span , span skinshrcolor: #2b91af">Type &span -span 一SpeBeE">s iultType &span ,
ring &span -eies in LI, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v t-PageBPeta Lambda3"sr> span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > ries in LI &span <span 一SpeBeE">span skinshrcolor: #2b91af">Funu &span &span <span 一SpeBeE">TArgumen. &span , span 一SpeBeE">TR iult &span >>
Peta Lambda &span <span 一SpeBeE">TArgumen. &span , span 一SpeBeE">TR iult &span >(
ring &span -eies in LI, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一CodeFragmen.cdPeta Lambda &span &span -overload pars7s a lambda eies in LI with the giv768span 一CodeFragmen.cdparameters &span a- Rspan 一CodeFragmen.cdeies in LI &span ">Funu &span <…>><&span i-stancedrees ien.ing thes iult. Ifthespan 一SpeBeE">span 一CodeFragmen.cds iultType &span &span -parameterdis non-null it specifies theret/ireddreiultipt"> for theeies in LI. Thespan 一CodeFragmen.cdvalues &span -parameterdsuphfihu zero or moreitblogs.#_Substitut" r_Valuesp >ubstitut" r values & that may be logerencedd- theeies in LI. &p>v > Theexample &p>v span 一SpeBeE"> span skinshrcolor: #2b91af">Parameterries in LI &span &span x = span 一SpeBeE"> span skinshrcolor: #2b91af">ries in LI &span .Parameter &span ( span skinshrcolor: bluep pt">of &span &span ( span skinshrcolor: bluep in. &span &span ), span skinshrcolor: #a31515">"x" &span ); br Exspan 一SpeBeE"> span skinshrcolor: #2b91af">Parameterries in LI &span &span y = span 一SpeBeE"> span skinshrcolor: #2b91af">ries in LI &span .Parameter &span ( span skinshrcolor: bluep pt">of &span &span ( span skinshrcolor: bluep in. &span &span ), span skinshrcolor: #a31515">"y" &span ); br Exspan 一SpeBeE"> span skinshrcolor: #2b91af">Lambdaries in LI &span &span -e = span 一SpeBeE"> span skinshrcolor: #2b91af"> and Quries in LI &span .Peta Lambda &span (
span skinshrcolor: #2b91af">Parameterries in LI &span &span [] { x, y }, span skinshrcolor: bluep null &span , span skinshrcolor: #a31515">"(x + y) * 2" &span ); &p>v creates &span a- Re" igINQ -Rspan 一CodeFragmen.cdries in LI<span 一SpeBeE">Funu &span <span 一SpeBeE">in. &span , span 一SpeBeE">in. &span , span 一SpeBeE">in. &span >><&span i-stancedtoRspan 一CodeFragmen.cde<&span rees ien.ing theeies in LI span 一CodeFragmen.cd(x &span -span 一CodeFragmen.cd+ &span -span 一CodeFragmen.cdy) &span -span 一CodeFragmen.cd* &span -span 一CodeFragmen.cd2 &span . Ifaret/ireddreiultipt"> is specified, au in &p>v span 一SpeBeE"> span skinshrcolor: #2b91af">Lambdaries in LI &span &span -e = span 一SpeBeE"> span tle" hrGramE"> span skinshrcolor: #2b91af"> and Quries in LI &span .Peta Lambda &span &span span tle" hrGramE">( &span br Exnbsp; nbsp; nbsp; span skinshrcolor: bluep new &span -span 一SpeBeE">span skinshrcolor: #2b91af">Parameterries in LI &span &span [] { x, y }, span 一SpeBeE"> span skinshrcolor: bluep pt">of &span &span ("(x + y) * 2" &span ); &p>v the &span -parsing operat" r will includeian tblogs.#_Ce-vern LIN">imst+xitice-vern LI & to the giv768reiultipt">,d- this case yielding -Rspan 一CodeFragmen.cdries in LI<span 一SpeBeE">Funu &span <span 一SpeBeE">in. &span , span 一SpeBeE">in. &span , double>><&span i-stance. &p>v ece-d & span 一SpeBeE">span 一CodeFragmen.cdPeta Lambda &span &span -overload pars7s a lambda eies in LI with a single un-Pagd-parameterdof f specified span 一SpeBeE">span 一CodeFragmen.cdargumen.Type &span &span . This methodors ipodds to ualfing thefirstspan 一SpeBeE">Peta Lambda &span overload with a span 一CodeFragmen.cdparameters &span argumen.ice-waining single span 一SpeBeE">span 一CodeFragmen.cdPetameterries in LI &span &span with an empty or null span 一CodeFragmen.cdNPag &span sroperty. &p>v cysnow- i-stance & giv768bytheun-Pagd-parameterdcan be logerencedd- whole using thekeywor Rspan 一CodeFragmen.cdit &span . Theexample &p>v span 一SpeBeE"> span skinshrcolor: #2b91af">Lambdaries in LI &span &span -e = span 一SpeBeE"> span tle" hrGramE"> span skinshrcolor: #2b91af"> and Quries in LI &span .Peta Lambda &span &span span tle" hrGramE">( &span br Exnbsp; nbsp; nbsp; span 一SpeBeE"> span skinshrcolor: bluep pt">of &span &span (Customnr<&span ), span 一SpeBeE"> span skinshrcolor: bluep pt">of &span &span ( span skinshrcolor: bluep bool &span &span ),
"COrders.Count &span ->= @1" &span ,
"Lond r" &span , 10); &p>v creates &span a- Re" igINQ -Rspan 一CodeFragmen.cdries in LI<span 一SpeBeE">Funu &span <Customnr, span 一SpeBeE">bool &span >><&span i-stancedtoRspan 一CodeFragmen.cde<&span . Note that span 一CodeFragmen.cdCubstitut" r values & todsuphfy theo-stant valuesspan 一CodeFragmen.cd"Lond r" &span a- Rspan 一CodeFragmen.cd10<&span . &p>v third & span 一SpeBeE">span 一CodeFragmen.cdPeta Lambda &span &span -overload is a span 一SpeBeE">genericly &span pt">d vern LI ofthe>ece-d-overload. Theexample beegwdsroduces thesameRspan 一CodeFragmen.cdries in LI<span 一SpeBeE">Funu &span <Customnr, span 一SpeBeE">bool &span >><&span i-stancedastheeiample above, but is st d to that eiactipt">. &p>v span skinshrcolor: #2b91af">ries in LI &span <span 一SpeBeE">span skinshrcolor: #2b91af">Funu &span &span <span skinshrcolor: #2b91af">Customnr<&span , span 一SpeBeE"> span skinshrcolor: bluep bool &span &span >>-e =
span skinshrcolor: #2b91af"> and Quries in LI &span .Peta Lambda &span <span skinshrcolor: #2b91af">Customnr<&span , span 一SpeBeE"> span skinshrcolor: bluep bool &span &span span tle" hrGramE">>(<&span br Exnbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span skinshrcolor: #a31515">"COrders.Count &span ->= @1" &span ,
"Lond r" &span , 10); &p>v

r> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sThePeta Methodro:p &o:p &span &h2>v span 一CodeFragmen.cdS em.Linq. and Qu. and Quries in LI &span &span -一 defhees thefoBegwing methodfor parsing - Rcreat"ng eies in LI t: 7 fragmen.N. &p>v span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > ries in LI &span Peta (Type &span -span 一SpeBeE">s iultType &span , span skinshrcolor: bluep > ring &span -eies in LI, br Exnbsp; nbsp; nbsp; span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一CodeFragmen.cds iultType &span &span -parameterdis non-null it specifies theret/ireddreiultipt"> oftheeies in LI. Thespan 一CodeFragmen.cdvalues &span -parameterdsuphfihu zero or moreitblogs.#_Substitut" r_Valuesp >ubstitut" r values & that may be logerencedd- theeies in LI. &p>v span 一CodeFragmen.cdPeta Lambda &span &span -methods,thespan 一CodeFragmen.cdPeta &span -methodRreturINQ -R“unbound” eies in LI t: 7 fragmen.. ThefoBegwing eiample usesspan 一GramE"> span 一CodeFragmen.cdPeta &span &span poRsroduce thesameRreiultias a tblogs.#Lambdariample1">es viousexample &a>: &p>v span 一SpeBeE"> span skinshrcolor: #2b91af">Parameterries in LI &span &span x = span 一SpeBeE"> span skinshrcolor: #2b91af">ries in LI &span .Parameter &span ( span skinshrcolor: bluep pt">of &span &span ( span skinshrcolor: bluep in. &span &span ), span skinshrcolor: #a31515">"x" &span ); br Exspan 一SpeBeE"> span skinshrcolor: #2b91af">Parameterries in LI &span &span y = span 一SpeBeE"> span skinshrcolor: #2b91af">ries in LI &span .Parameter &span ( span skinshrcolor: bluep pt">of &span &span ( span skinshrcolor: bluep in. &span &span ), span skinshrcolor: #a31515">"y" &span ); br Exspan skinshrcolor: #2b91af"> ict" rary &span <span skinshrcolor: bluep > ring &span , span skinshrcolor: bluep object &span >-symboes = span skinshrcolor: bluep new &span -span skinshrcolor: #2b91af"> ict" rary &span <span skinshrcolor: bluep > ring &span , span skinshrcolor: bluep object &span >(); br Exspan 一SpeBeE">symboes.Add &span ("x" &span , x); br Exspan 一SpeBeE">symboes.Add &span ("y" &span , y); br Exspan skinshrcolor: #2b91af">ries in LI &span "> span skinshrcolor: #2b91af"> and Quries in LI &span .Peta &span ("(x + y) * 2" &span ,-symboes); br Exspan 一SpeBeE"> span skinshrcolor: #2b91af">Lambdaries in LI &span &span -e = span 一SpeBeE"> span skinshrcolor: #2b91af">ries in LI &span .Lambda &span (
span skinshrcolor: #2b91af">Parameterries in LI &span &span [] { x, y }); &p>v ubstitut" r values & that can be logerencedd- theeies in LI. &p>v

span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sSubstitut" r Valuesro:p &o:p &span &h2>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p >ubstitut" r values &span &em> poRbe specified through a-parameterdarray. Substitut" r values areilogerencedd- -Reies in LI using tblogs.#_Iden.ifierN">iden.ifierN & oftheform span 一CodeFragmen.cd@x &span ,-where span 一CodeFragmen.cdx &span -is an index - toRtheparameterdarray. Thet elemen.ioftheparameterdarray may be an object that implemen.Nspan 一SpeBeE">span 一CodeFragmen.cdI ict" rary &span &span span tle" hrCodeFragmen.cd<skring, object><&span . Ifso,this dict" raryis us>d to map iden.ifierN todsubstitut" r values during parsing. &p>v v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">If<&span phevalueis oftt"> span 一SpeBeE">span 一CodeFragmen.cdS em.Linq.ries in LIN.Lambdaries in LI &span &span ,theiden.ifier mut occur aspartof a tblogs.#_ and Qu_ries in LI_Invocat" r">dand Quelambda invocat" r & . This aBegws composit" r of dand Quelambda eies in LIN. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span Otherwis>,d-f phevalueis oftt"> span 一SpeBeE">span 一CodeFragmen.cdS em.Linq.ries in LIN.ries in LI &span &span ,thegiv768eies in LI is substituted for theiden.ifier. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span Otherwis>,dthespan 一SpeBeE">span 一CodeFragmen.cdries in LI.Co-stant &span &span span tle" hrCodeFragmen.cd &span methodRis us>d to create a o-stant eies in LI from phevaluewhichRis th768substituted for theiden.ifier. &p>v

> t-PageB_ and Qu_ ata_C一esp r> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s and Que ata C一huro:p &o:p &span &h2>v span 一CodeFragmen.cdS em.Linq. and Qu. and Quries in LI &span &span -一 defhees thefoBegwing methods for dand Qualfy creat"ng data 一eN. &p>v span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Type &span -span 一SpeBeE">CreateC一 &span ( span skinshrcolor: bluep paramN &span &span - span 一SpeBeE"> span skinshrcolor: #2b91af"> and QuProperty &span &span [] sroperties); &p>v span tle" hrGramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Type &span -span 一SpeBeE">CreateC一 &span ( span skinshrcolor: #2b91af">IEnumerable<&span &span <span 一SpeBeE">span skinshrcolor: #2b91af"> and QuProperty &span &span >-sroperties); &p>v span 一CodeFragmen.cdCreateC一 &span &span -methodreates a new data 一 with a giv768setof publQu-sroperties a- RreturINQthespan 一SpeBeE">span 一CodeFragmen.cdS em.Type &span &span -object for thenewfy created 一. Ifadata 一 with an iden.iual8set/jnceof sroperties has already b 768created,dthespan 一SpeBeE">span 一CodeFragmen.cdS em.Type &span &span -object for this c一 is returIed. &p>v acc inors &span for thespecified sroperties. Data 一eN also override thespan 一CodeFragmen.cdEquals &span a- Rspan 一SpeBeE">span 一CodeFragmen.cdGetHashCode &span &span -members to implemen. by-valueequality. &p>v span 一CodeFragmen.cdS em.Linq. and Qu. and QuC一 &span &span -a- Reregiv768autom v span 一CodeFragmen.cdCreateC一 &span &span -methods to generate 一eN from tblogs.#_Anonymous_Object_Indata object ind with the dand Quespan 一CodeFragmen.cdSelect &span -methodto create sroject LIN. &p>v span 一CodeFragmen.cdCreateC一 &span &span -to create a data 一 with two sroperties,espan 一CodeFragmen.cdNPag &span a- Rspan 一CodeFragmen.cdBirthday &span , - thenduses.NET loglect LI-to create an i-stancedofthe我一 a- Re" igI values toRtheproperties. &p>v span 一SpeBeE"> span skinshrcolor: #2b91af"> and QuProperty &span &span [] srops = span skinshrcolor: bluep new &span -span 一SpeBeE"> span skinshrcolor: #2b91af"> and QuProperty &span &span [] { br Exnbsp; nbsp; nbsp; span skinshrcolor: bluep new &span -span 一SpeBeE">span skinshrcolor: #2b91af"> and QuProperty &span &span ("NPag" &span , span 一SpeBeE"> span skinshrcolor: bluep pt">of &span &span ( ring &span )),
span skinshrcolor: #2b91af"> and QuProperty &span &span ("Birthday" &span , span 一SpeBeE"> span skinshrcolor: bluep pt">of &span &span (span skinshrcolor: #2b91af"> ateTimh &span &span )) }; br Exspan skinshrcolor: #2b91af">Type &span -span 一SpeBeE">type &span -= span 一SpeBeE"> span skinshrcolor: #2b91af"> and Quries in LI &span .CreateC一 &span (srops); br Exspan skinshrcolor: bluep object &span span 一SpeBeE">obj &span -= span 一SpeBeE"> span skinshrcolor: #2b91af">Act vator &span .CreateI-stance &span (type); br Exspan 一SpeBeE">t.GetProperty &span ("NPag" &span ).span 一SpeBeE">SetValue &span (obj &span , span skinshrcolor: #a31515">"Albert" &span , span skinshrcolor: bluep null &span ); br Exspan 一SpeBeE">t.GetProperty &span ("Birthday" &span ).span 一SpeBeE">SetValue &span (obj &span , span skinshrcolor: bluep new &span -span 一SpeBeE">span skinshrcolor: #2b91af"> ateTimh &span &span (1879, 3, 14), span skinshrcolor: bluep null &span ); br Exspan 一SpeBeE">span skinshrcolor: #2b91af">Co-sole<&span .WriteLine &span (obj &span ); &p>v

r> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sIyan.yvar Eiwidn LI Methodsro:p &o:p &span &h2>v span 一CodeFragmen.cdS em.Linq. and Qu. and Quyan.yvar &span &span -一 implemen.NthefoBegwing eiwidn LI methods for dand Qualfy t/javing objects that implemen. thespan 一CodeFragmen.cdIyan.yvar <T><&span i-terface. &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span Where( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source,
ring &span -es d+xmle, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span <T> Where<T>( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span <T> source,
ring &span -es d+xmle, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span Select( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source,
ring &span -selector, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span span 一SpeBeE">OrderBy &span ( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source,
ring &span -ordering, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span <T> span 一SpeBeE">OrderBy &span <T>( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span <T> source,
ring &span -ordering, span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span Take( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source, span 一SpeBeE"> span skinshrcolor: bluep in. &span &span lount); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span Skip( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source, span 一SpeBeE"> span skinshrcolor: bluep in. &span &span lount); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > Iyan.yvar &span span 一SpeBeE">GroupBy &span ( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source,
ring &span - span 一SpeBeE">keySelector &span , span skinshrcolor: bluep > ring &span - span 一SpeBeE">elemen.Selector &span , span 一SpeBeE"> span skinshrcolor: bluep paramN &span &span - span skinshrcolor: bluep object &span [] values); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > span skinshrcolor: bluep bool &span &span Any( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source); &p>v span 一GramE"> span skinshrcolor: bluep publQu &span &span - span skinshrcolor: bluep > span skinshrcolor: bluep in. &span &span Count( span skinshrcolor: bluep phis &span -span skinshrcolor: #2b91af">Iyan.yvar &span source); &p>v span 一CodeFragmen.cdS em.Linq.yan.yvar &span &span -ounterparts, except that they operate LI span 一CodeFragmen.cdIyan.yvar &span i-stead ofspan 一CodeFragmen.cdIyan.yvar <T><&span a- Ruseskrings i-stead oflambda eies in LIN toReies in-es d+xmles, selectors, - orderings. span 一CodeFragmen.cdIyan.yvar &span iNthenon-generic base i-terface for span 一CodeFragmen.cdIyan.yvar <T><&span , so themethodsan be us>d ev768wh768span 一CodeFragmen.cdT &span iNn’t known LI beforeh - , i.e.8wh768thesource of a t/jav is dand Qualfy determ> <. (Note that becausea dand Qu-es d+xmle or ordering does no- fffect the8reiultipt">,dgeneric overloadN areisrovided for span 一CodeFragmen.cdWhere<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cdOrderBy &span &span - order poRsrea rveskrong typing wh768poin ar .) &p>v span 一CodeFragmen.cdkeySelector &span &span , a- Rspan 一SpeBeE">span 一CodeFragmen.cdelemen.Selector &span &span -earameters areiskrings ce-waining eies in LIN written - thetblogs.#_ries in LI_LanguEndc>eies in LI languEnd & . I theeies in LIiskrings, themembers ofthetblogs.#_Cysnow-_I-stance">cysnow- i-stance & areiautom v span 一CodeFragmen.cdOrderBy &span &span methodpermits a set/jnceof orderings poRbe specified, seearated by cemmas. Each ordering may opt" ralfy befoBegwed by span 一SpeBeE">span 一CodeFragmen.cdasu &span &span -or span 一CodeFragmen.cdasce;ding &span -to ind+xmle asce;ding span 一GramE">order, &span -or span 一SpeBeE">span 一CodeFragmen.cddesu &span &span -or span 一CodeFragmen.cddesue;ding &span -to ind+xmle desue;ding order. Thedefaultiorder is asue;ding. Theexample &p>v span 一SpeBeE"> span 一GramE">sroducts.OrderBy &span &span span tle" hrGramE">( &span span skinshrcolor: #a31515">"span 一SpeBeE">Cmlegory.CmlegoryNPag &span , span 一SpeBeE">UnitPrice<&span desue;ding" &span ); &p>v orders &span a8set/jnceof sroducts by asce;ding cmlegory-Pag - , with- each cmlegory, desue;ding unit srich. &p>v

Peta Except LI &span C一 o:p &o:p &span &h2>v span 一CodeFragmen.cdS em.Linq. and Qu.Peta Except LI &span &span -一. Thespan 一CodeFragmen.cdPosit" r &span -esoperty-ofthespan 一SpeBeE">span 一CodeFragmen.cdPeta Except LI &span &span -一giv7s theharacter index - theeies in LIiskring at whichRtheparsing error occurred. &p>v

t-PageB_ries in LI_LanguEndc>r> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sries in LI LanguEndro:p &o:p &span &h1>v v d to befamiliar poRC#, VB, a- RSQL users. For this reasLI, somh operatorN areisr ien. - multiple forms, suchRasspan 一CodeFragmen.cd&&<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cd - &span &span . &p>v

r> span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sIden.ifierN o:p &o:p &span &h2>v v span 一GramE">x &span nbsp; nbsp; HeBeonbsp; nbsp; m_1nbsp; nbsp; @truenbsp; nbsp; @S ring &p>v d to denote the tblogs.#_Substitut" r_Valuesp >ubstitut" r values & ,d-f any, that were pass>d to theeeies in LI pars7r. For example: &p>v span 一SpeBeE"> span 一GramE">customnr.Where<&span &span span tle" hrGramE">( &span span skinshrcolor: #a31515">"Country = @0" &span , country); &p>v v

v v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p inlegnr literal &span &em> o-sists ofa set/jnceof digits. Thept"> ofan inlegnr literal iNthefirstofthept">sspan 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , or span 一CodeFragmen.cdUInt64 &span that can rees ien.thegiv768value. An inlegnr literal imst+xitfy ce-vedes to any other tblogs.#NumericTypesp numeric type &a>isrovided thenumber is - therangedofthatipt">. Somh examples ofinlegnr literalN: &p>v 0nbsp; nbsp; 123nbsp; nbsp; 10000 &p>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p real literal &span &em> o-sists ofan inlegral-partfoBegwed by a fract" ral-part - /or a68eieonen.. Theinlegral-partis a set/jnceof one or moreidigits. Thefract" ral-partis a deimal-poinlfoBegwed by one or moreidigits. Theeieonen. iNtheletterdspan 一CodeFragmen.cde &span -or span 一CodeFragmen.cdE &span -foBegwed by an opt" ral span 一CodeFragmen.cd+ &span -or span 一CodeFragmen.cd–<&span igI foBegwed by one or moreidigits. Thept"> ofa real literal iNspan 一GramE"> span 一CodeFragmen.cdDouble<&span &span . A real literal imst+xitfy ce-vedes to any other tblogs.#RealTypesp real type &a>isrovided thenumber is - therangedofthatipt">. Somh examples ofreal literalN: &p>v 1.0nbsp; nbsp; 2.25 nbsp; nbsp; 10000.0nbsp; nbsp; 1e0nbsp; nbsp; 1e10nbsp; nbsp; 1.2345E-4 &p>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p skring literal &span &em> o-sists ofzero or moreiharacters jnclos7d - doublet/otes. I side a skring literal,dadoublet/ote is written astwo o-secut"ve doublet/otes. Thept"> ofa skring literal iNspan 一CodeFragmen.cdS ring &span . Somh examples ofskring literalN: &p>v "span 一GramE">heBeo &span "nbsp; nbsp; ""nbsp; nbsp; nbsp; """t/oted"""nbsp; nbsp; "'" &p>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p haracter literal &span &em> o-sists ofa single haracter jnclos7d - single t/otes. I side a haracter literal,a single t/ote is written astwo o-secut"ve single t/otes. Thept"> ofa haracter literal iNspan 一CodeFragmen.cdChar &span . Somh examples ofharacter literal: &p>v 'A'nbsp; nbsp; '1'nbsp; nbsp; ''''nbsp; nbsp; '"' &p>v

v Rspan 一CodeFragmen.cdBoolean &span . &p>v span 一CodeFragmen.cdObject &span , but is also imst+xitfy ce-vede ar to any logerence pt">. &p>v

t-PageB_Typesp > span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sTypes o:p &o:p &span &h2>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p primit"ve types &span &em>: &p>v span 一CodeFragmen.cdSByte<&span &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; Rspan 一CodeFragmen.cdByte<&span br Exspan 一CodeFragmen.cdInt16 &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; Rspan 一CodeFragmen.cdUInt16 &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一CodeFragmen.cdInt32 &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; Rspan 一CodeFragmen.cdUInt32 &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一CodeFragmen.cdInt64 &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; Rspan 一CodeFragmen.cdUInt64 &span br Exspan 一CodeFragmen.cdDeimalnbsp; nbsp; nbsp; nbsp; RSingle &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一CodeFragmen.cdDouble<&span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一SpeBeE">span 一CodeFragmen.cd ateTimh &span &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一SpeBeE">span 一CodeFragmen.cdTimhSpan &span &span nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; span 一SpeBeE">span 一CodeFragmen.cdGui &span &span &p>v span skinshrfe-w-family: 'Calibri','sans-sn.zf'p acc in ar types &span &em> o-sisting ofthepsimit"ve types - thefoBegwing typesfrom pheS em-Pagspace: &p>v v d to methodsderedd- theacc in ar types. &p>v em>span skinshrfe-w-family: 'Calibri','sans-sn.zf'p nullvar &span &em>&span em>span skinshrfe-w-family: 'Calibri','sans-sn.zf'p form &span &em> ofa valuett"> is regerenceddbywriting span 一GramE">a span 一CodeFragmen.cd? &span &span - span 一GramE">aftnr<&span thett"> -Pag.- span 一GramE">For example, span 一CodeFragmen.cdInt32? &span &span - span 一GramE">denotes<&span thespan 一SpeBeE">nullvar &span form ofspan 一CodeFragmen.cdInt32 &span . &p>v Thenon-span 一SpeBeE">nullvar &span a- Rspan 一SpeBeE">nullvar &span formsofthept">sspan 一SpeBeE">span 一CodeFragmen.cdSByte<&span &span , span 一CodeFragmen.cdByte<&span , span 一CodeFragmen.cdInt16 &span , span 一CodeFragmen.cdUInt16 &span , span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , a- Rspan 一CodeFragmen.cdUInt64 &span areicoBeect vefy caBee theem>span skinshrfe-w-family: 'Calibri','sans-sn.zf'p inlegral types &span &em>.- &p>v t-PageBRealTypesp > Thenon-span 一SpeBeE">nullvar &span a- Rspan 一SpeBeE">nullvar &span formsofthept">sspan 一CodeFragmen.cdSingle &span , span 一CodeFragmen.cdDouble<&span , a- Rspan 一CodeFragmen.cdDeimal &span areicoBeect vefy caBee theem>span skinshrfe-w-family: 'Calibri','sans-sn.zf'p real types &span &em>. &p>v Theinlegral types a- Rreal types areicoBeect vefy caBee theem>span skinshrfe-w-family: 'Calibri','sans-sn.zf'p numeric types &span &em>. &p>v

span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sCe-vern LIN o:p &o:p &span &h2>v v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span thespan 一SpeBeE">the &span - span 一CodeFragmen.cdnull &span literal to any logerence pt">-or span 一SpeBeE">nullvar &span pt">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span an inlegnr literal to an tblogs.#InlegralTypesp inlegral type & or tblogs.#RealTypesp real type &a>isrovided thenumber is with- therangedofthatipt">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span a real literal to a tblogs.#RealTypesp real type &a>isrovided thenumber is with- therangedofthatipt">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span a skring literal to an span 一SpeBeE">enum &span pt">isrovided theskring literal lo-wainu the-Pag ofa memberdofthatispan 一SpeBeE">enum &span pt">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span a source pt">ithat isRe" igImen. ompae ar with the targetipt"> according toRthe span 一SpeBeE">span 一CodeFragmen.cdTt">.IsA" igIvar From<&span <&span methodRin.NET. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span a non-span 一SpeBeE">nullvar &span valuett"> toRthe span 一SpeBeE">nullvar &span form ofthat valuett">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">From<&span a tblogs.#NumericTypesp numeric type &a>ito another numeric type with greater range. &p>v em>type &em>span 一CodeFragmen.cd(<&span <&span span 一SpeBeE">em>exes &em>&span span 一CodeFragmen.cd)<&span , where em>type &em>is a tt"> -Pag opt" ralfy foBegwed by span 一CodeFragmen.cd? &span - span 一GramE">a- &span span 一SpeBeE">em>exes &em>&span -is an eies in LI. This sy-waxmay be us>d to perform thefoBegwing ce-vern LIN: &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">Betweer &span -two types srovided span 一SpeBeE">span 一CodeFragmen.cdTt">.IsA" igIvar From<&span <&span iNtruy - one or both direct LIN. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">Betweer &span -two types srovided one or both areii-terface types. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span span 一GramE">Betweer &span -the span 一SpeBeE">nullvar &span a- Rnon-span 一SpeBeE">nullvar &span formsofany valuett">. &p>v span skinshrfe-w-family: Symboe"s· &span span skinshr/hee-heigh.: 115%; fe-w-family: 'Timhu New Rocri','sn.zf'; fe-w-sizet/cad> nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; nbsp; &span Betweerany two types beegnging toRthe seto-sisting ofspan 一SpeBeE">span 一CodeFragmen.cdSByte<&span &span , span 一CodeFragmen.cdByte<&span , span 一CodeFragmen.cdInt16 &span , span 一CodeFragmen.cdUInt16 &span , span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , span 一CodeFragmen.cdDouble<&span , span 一CodeFragmen.cdChar &span ,any span 一SpeBeE">enum &span pt">, asweBe asthe span 一SpeBeE">nullvar &span formsofthose types. &p>v

span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sOperatorN o:p &o:p &span &h2>v , - span 一CodeFragmen.cdm &span denotes a member. &p>v v skrong>Cmlegory &skrong> &p>v skrong>ries in LI &skrong> &p>v skrong>Descript LI &skrong> &p>v v Primary &p>v span 一SpeBeE">span 一CodeFragmen.cdx.m<&span <&span &p>v I-stance fiel ori-stancedesoperty-acc in. Any publQu-fiel oresoperty-can be acc ined. &p>v span 一SpeBeE">span 一GramE"> span 一CodeFragmen.cdx.m<&span <&span &span span 一GramE">span 一CodeFragmen.cd(<&span <&span span 一CodeFragmen.cd…)<&span &p>v I-stance tblogs.#_Ce-structor_ - _MethodcdmethodRinvocat" r & . Themethod mut beisublQu- - mut beideredd- an tblogs.#_Ps defheed_typesp acc in ar type & . &p>v span 一GramE"> span 一CodeFragmen.cdx[<&span <&span span 一CodeFragmen.cd…]<&span &p>v Array ori-dexer-acc in. Multi-dimidn LIal arrayN areino- suph=deed. &p>v span 一SpeBeE">span 一CodeFragmen.cdT.m<&span <&span &p>v S v span 一SpeBeE">span 一GramE"> span 一CodeFragmen.cdT.m<&span <&span &span span 一GramE">span 一CodeFragmen.cd(<&span <&span span 一CodeFragmen.cd…)<&span &p>v S v span 一GramE"> span 一CodeFragmen.cdT(<&span <&span span 一CodeFragmen.cd…)<&span &p>v tblogs.#_Ce-vern LINp Eiet+xit ce-vern LI & or tblogs.#_Anonymous_Object_Creat LIcdce-structorRinvocat" r & . Note that span 一CodeFragmen.cdnew &span -is no- requiredd- front ofa e-structorRinvocat" r. &p>v span 一GramE"> span 一CodeFragmen.cdnew(<&span <&span span 一CodeFragmen.cd…)<&span &p>v tblogs.#_Data_Object_Initializercd ata object span 一SpeBeE">initializer<&span & . This e-structan be us>d to perform dand Qu-esoject LIN. &p>v span 一CodeFragmen.cdit &span &p>v tblogs.#_Cysnow-_I-stance">Cysnow- i-stance & . I lo-wexts where members ofa ysnow- object areiimst+xitfy - scope, span 一CodeFragmen.cdit &span -is us>d to loger to theeentire object itself. &p>v span 一GramE"> span 一CodeFragmen.cdx(<&span <&span span 一CodeFragmen.cd…)<&span &p>v tblogs.#_ and Qu_ries in LI_Invocat" rcd and Qu-lambda invocat" r & . Us>d to logerence another dand Qu-lambda eies in LI. &p>v span 一SpeBeE">span 一CodeFragmen.cdiif<&span <&span span 一CodeFragmen.cd(x, &span -span 一CodeFragmen.cdy, &span -span 一CodeFragmen.cdz)<&span &p>v Ce-dit" ral eies in LI. Alternmle sy-waxfor span 一GramE"> span 一CodeFragmen.cdx &span -span 一CodeFragmen.cd? &span &span - span 一CodeFragmen.cdy &span - span 一CodeFragmen.cd: &span -span 一CodeFragmen.cdz &span . &p>v Unary &p>v span 一CodeFragmen.cd-x<&span &p>v Negat" r. Suph=deed types arei span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , a- Rspan 一CodeFragmen.cdDouble<&span . &p>v span 一CodeFragmen.cd!x<&span &p>v span 一CodeFragmen.cdno- x<&span &p>v LogQual negat" r. Opera- mut beispan 一GramE">of<&span pt">Rspan 一CodeFragmen.cdBoolean &span . &p>v Multipl+xmlive &p>v span 一CodeFragmen.cdx * y<&span &p>v Multipl+xmli r. Suph=deed types arei span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , a- Rspan 一CodeFragmen.cdDouble<&span . &p>v span 一CodeFragmen.cdx / y<&span &p>v Divisi r. Suph=deed types arei span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , a- Rspan 一CodeFragmen.cdDouble<&span . &p>v span 一CodeFragmen.cdx % y<&span &p>v span 一CodeFragmen.cdx mod y<&span &p>v Remai-der. Suph=deed types arei span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , a- Rspan 一CodeFragmen.cdDouble<&span . &p>v Addilive &p>v span 一CodeFragmen.cdx + y<&span &p>v Addit" r or> ring concmlenmli r. Performs> ring concmlenmli r if either opera- is oftt"> span 一CodeFragmen.cdS ring &span . Otherwise, performs addit" r for thesuph=deed types span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一CodeFragmen.cdDeimal &span , span 一CodeFragmen.cdSingle &span , span 一CodeFragmen.cdDouble<&span , span 一SpeBeE">span 一CodeFragmen.cd ateTimh &span &span , a- Rspan 一SpeBeE">span 一CodeFragmen.cdTimhSpan &span &span . &p>v span 一CodeFragmen.cdx – y<&span &p>v Subtracti r. Suph=deed types arei span 一CodeFragmen.cdInt32 &span , span 一CodeFragmen.cdUInt32 &span , span 一CodeFragmen.cdInt64 &span , span 一CodeFragmen.cdUInt64 &span , span 一GramE"> span 一CodeFragmen.cdDeimal &span &span , span 一CodeFragmen.cdSingle &span , span 一CodeFragmen.cdDouble<&span , span 一SpeBeE">span 一CodeFragmen.cd ateTimh &span &span , a- Rspan 一SpeBeE">span 一CodeFragmen.cdTimhSpan &span &span . &p>v span 一CodeFragmen.cdx & y<&span &p>v S ring concmlenmli r. Opera- smay be ofany tt">. &p>v Relat" ral &p>v span 一CodeFragmen.cdx = y<&span &p>v span 一CodeFragmen.cdx == y<&span &p>v Equal. Suph=deed for logerence pt">s - thetblogs.#_Ps defheed_typesp psimit"ve types & . A" igImen. is no- suph=deed. &p>v span 一CodeFragmen.cdx != y<&span &p>v span 一CodeFragmen.cdx <> y<&span &p>v No- equal. Suph=deed for logerence pt">s - thetblogs.#_Ps defheed_typesp psimit"ve types & . &p>v span 一CodeFragmen.cdx < y<&span &p>v Less than. Suph=deed for alltblogs.#_Ps defheed_typesp psimit"ve types & except span 一CodeFragmen.cdBoolean &span , span 一CodeFragmen.cdObject<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cdGuid &span &span . &p>v span 一CodeFragmen.cdx > y<&span &p>v Greater than. Suph=deed for alltblogs.#_Ps defheed_typesp psimit"ve types & except span 一CodeFragmen.cdBoolean &span , span 一CodeFragmen.cdObject<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cdGuid &span &span . &p>v span 一CodeFragmen.cdx <= y<&span &p>v Less than orequal. Suph=deed for alltblogs.#_Ps defheed_typesp psimit"ve types & except span 一CodeFragmen.cdBoolean &span , span 一CodeFragmen.cdObject<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cdGuid &span &span . &p>v span 一CodeFragmen.cdx >= y<&span &p>v Greater than orequal. Suph=deed for alltblogs.#_Ps defheed_typesp psimit"ve types & except span 一CodeFragmen.cdBoolean &span , span 一CodeFragmen.cdObject<&span a- Rspan 一SpeBeE">span 一CodeFragmen.cdGuid &span &span . &p>v LogQual AND &p>v span 一CodeFragmen.cdx && y<&span &p>v span 一CodeFragmen.cdx a- Ry<&span &p>v LogQual AND. Opera- smut beispan 一GramE">of<&span pt">Rspan 一CodeFragmen.cdBoolean &span . &p>v LogQual OR &p>v span 一CodeFragmen.cdx || y<&span &p>v span 一CodeFragmen.cdx or y<&span &p>v LogQual OR. Opera- smut beispan 一GramE">of<&span pt">Rspan 一CodeFragmen.cdBoolean &span . &p>v Ce-dit" ral &p>v span 一GramE"> span 一CodeFragmen.cdx ? &span &span span 一CodeFragmen.cd y : z<&span &p>v Evaluates span 一CodeFragmen.cdy &span -if span 一CodeFragmen.cdx<&span is true, evaluates span 一CodeFragmen.cdz &span -if span 一CodeFragmen.cdx<&span is fals>. &p>v

tnamshr_Anonymous_Object_Creat LIcd & tnamshr_Ce-structor_ - _Methodcd & span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sMethod a- RCe-structor Invocat" rN o:p &o:p &span &h2>v v v s sul>s simir to C#. I infottpe terms, overload s iolut" r will pick thebest matching method, e-structor, ori-dexer, orreh=dean ambiguity errorif no singlebest matchan be identified. &p>v span 一CodeFragmen.cd ateTimh &span &span i-stancedfor a span 一SpeBeE">specfic &span year, me-wh, a- Rday using a e-structorRinvocat" r: &p>v span 一SpeBeE">span 一GramE">orders.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p "span 一SpeBeE">Order ate &span >= span 一SpeBeE"> ateTimh &span (2007, 1, 1)" &span ); &p>v

tnamshr_Anonymous_Object_Initializercd & tnamshr_Data_Object_Initializercd & span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s ata Object InitializerN o:p &o:p &span &h2>v initializer<&span creates a tblogs.#_ and Qu_Data_C一esp data 一 & a- RreturrN ani-stancedofthat 一. Theesoperties ofthedata 一 areiinferred from thedata object span 一SpeBeE">initializer<&span . Specifiually, aRdata object span 一SpeBeE">initializer<&span ofthefott &p>v span 一GramE">new(<&span e1 as p1, e2 as p2, e3 as p3) &p>v creates<&span adata 一 withthreeesoperties, span 一CodeFragmen.cdp1 &span , span 一CodeFragmen.cdp2 &span , a- Rspan 一CodeFragmen.cdp3 &span , thept">sofwhichareiinferred from theeies in LIs span 一CodeFragmen.cde1 &span , span 一CodeFragmen.cde2 &span , a- Rspan 一CodeFragmen.cde3 &span , a- RreturrN ani-stancedofthat data 一 withtheesoperties initialized to theevalues emputed by span 一CodeFragmen.cde1 &span , span 一CodeFragmen.cde2 &span , a- Rspan 一CodeFragmen.cde3 &span . Aesoperty- span 一SpeBeE">initializer<&span may omitthespan 一CodeFragmen.cdas<&span keyword - theesoperty-namsesovideddthe一ociated eies in LIiis a fiel oresoperty-acc in. Theeiample &p>v span 一SpeBeE">span 一GramE">customers.Select<&span &span span 一GramE">( &span span skinshrcolor: #a31515p "new(CempanyNamh &span as Namh, Phone)" &span ); &p>v creates<&span adata 一 withtwoesoperties, span 一CodeFragmen.cdNamh &span a- Rspan 一CodeFragmen.cdPhone &span , a- RreturrN a sequencedofi-stancesdofthat data 一 initialized from thespan 一SpeBeE">span 一CodeFragmen.cdCempanyNamh &span &span a- Rspan 一CodeFragmen.cdPhone &span esoperties ofeach customer. &p>v

tnamshr_Cysnow-_I-stance"> & span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sCysnow- I-stance o:p &o:p &span &h2>v ring, - thetblogs.#_Cysnow-_I-stance"> em span skinshrfe-w-family: 'Calibri','sans-serif'; color: windowwext; wext-deorat" r:Rnone; wext-u-der/hee:Rnone">cusnow- i-stance &span &em & given by the unnamsd paramsteran be logerencedd- wholeusing the keywordspan 一CodeFragmen.cdit &span . Foreiample, &p>v span 一SpeBeE">span 一GramE">customers.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p "Country= @0" &span , country); &p>v is<&span equivalow- to &p>v span 一SpeBeE">span 一GramE">customers.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p " span 一SpeBeE">it.Country<&span = @0" &span , country); &p>v v

tnamshr_ and Qu_ries in LI_Invocat" rcd & span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s and Qu-Lambda Invocat" r o:p &o:p &span &h2>v span 一CodeFragmen.cdSystem.Linq.ries in LIs.Lambdaries in LI &span &span , followed by aI argumen. list. Theargumen.s suphlie mut beiempat"ar withtheearamsterlist ofthe given dand Qu-lambda eies in LI. &p>v v span skinshrcolor: #2b91afp Eies in LI &span <span 一SpeBeE">span skinshrcolor: #2b91afp Func &span &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >> e1 =
    span 一SpeBeE">span skinshrcolor: #2b91afp and QuEies in LI &span .ParseLambda &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span span 一GramE">>( &span span skinshrcolor: #a31515p "City = \"London\"" &span ); br />span skinshrcolor: #2b91afp Eies in LI &span <span 一SpeBeE">span skinshrcolor: #2b91afp Func &span &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >> e2 =
    span 一SpeBeE">span skinshrcolor: #2b91afp and QuEies in LI &span .ParseLambda &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >( span skinshrcolor: #a31515p " span 一SpeBeE">Orders.Count &span >= 10" &span ); br />span skinshrcolor: #2b91afp IQueryvar &span <span skinshrcolor: #2b91afp Customer<&span > query =
    span 一SpeBeE">db.Customers.Where &span ( span skinshrcolor: #a31515p "@0(it) - @1(it)" &span , e1, e2); &p>v v span skinshrcolor: #2b91afp Eies in LI &span <span 一SpeBeE">span skinshrcolor: #2b91afp Func &span &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >> e1 =
    c => span 一SpeBeE">c.City<&span == span skinshrcolor: #a31515p "London" &span span 一GramE">; &span br />span skinshrcolor: #2b91afp Eies in LI &span <span 一SpeBeE">span skinshrcolor: #2b91afp Func &span &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >> e2 =
    span 一SpeBeE">span skinshrcolor: #2b91afp and QuEies in LI &span .ParseLambda &span <span skinshrcolor: #2b91afp Customer<&span , span 一SpeBeE">span skinshrcolor: blue">bool &span &span >( span skinshrcolor: #a31515p " span 一SpeBeE">Orders.Count &span >= 10" &span ); br />span skinshrcolor: #2b91afp IQueryvar &span <span skinshrcolor: #2b91afp Customer<&span > query =
    span 一SpeBeE">db.Customers.Where &span ( span skinshrcolor: #a31515p "@0(it) - @1(it)" &span , e1, e2); &p>v v span skinshrcolor: #2b91afp IQueryvar &span <span skinshrcolor: #2b91afp Customer<&span > query =
    span 一SpeBeE">db.Customers.Where &span (c => span 一SpeBeE">c.City<&span == span skinshrcolor: #a31515p "London" &span && span 一SpeBeE">c.Orders.Count &span >= 10) span 一GramE">; span skinshrdisplay:Rnone; mso-hide: all">I &span &span span skinshrdisplay:Rnone; mso-hide: all">a es d+xmleeies in LI u-lambda eies in LIs - ther embhees themdthrough dand Qu-lambda invocat" rs<&span &p>v

span 一GramE"> span skinshrdisplay:Rnone; mso-fareast-fe-w-family: 'Timhu New Rocri'; mso-hide: all">embhees &span &span span skinshrdisplay:Rnone; mso-fareast-fe-w-family: 'Timhu New Rocri'; mso-hide: all">twospan 一SpeBeE">seperately<&span parsed-lambda eies in LIs - a singlespan 一SpeBeE">es d+xmle:e &span dand Qu-lambda eies in LI.span 一SpeBeE">System.Linq.ries in LIs.Lamspan skinshrmso-hide: none">Sequence &span &span &span span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s operators o:p &o:p &span &h2>v span 一CodeFragmen.cdIEnumervar &span &span span 一CodeFragmen.cd<T><&span . Specifiually, thefollowing e-struct areipermiteed, where span 一SpeBeE">em>seq &em &span iN anspan 一SpeBeE">span 一CodeFragmen.cdIEnumervar &span &span span 一CodeFragmen.cd<T><&span i-stance, em es d+xmle &em iis a span 一SpeBeE">span 一GramE">boolean &span <&span eies in LI, a- Rem>selector &em iis aneies in LI ofany tt">: &p>v span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdWhere &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p es d+xmle &span <&em &span span 一CodeFragmen.cd)<&span                             span 一SpeBeE">em>span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span span 一CodeFragmen.cd. &span span 一CodeFragmen.cdAny &span - span 一CodeFragmen.cd(&span span 一CodeFragmen.cd)<&span &p>v span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdAny &span - span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p es d+xmle &span <&em &span span 一CodeFragmen.cd)<&span                                  span 一SpeBeE">em>span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span span 一CodeFragmen.cd. &span span 一CodeFragmen.cdAll &span - span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p es d+xmle &span <&em &span ) &p>v span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdCeunt &span span 一CodeFragmen.cd(&span span 一CodeFragmen.cd)<&span                                                 span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdCeunt &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p es d+xmle &span <&em &span span 一CodeFragmen.cd)<&span &p>v span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdMin &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p selector &span <&em &span span 一CodeFragmen.cd)<&span                                     span 一SpeBeE">em>span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span span 一CodeFragmen.cd. &span span 一CodeFragmen.cdMax &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p selector &span <&em &span span 一CodeFragmen.cd)<&span &p>v span 一SpeBeE">span 一GramE"> em span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span &span span 一GramE">span 一CodeFragmen.cd. &span <&span span 一CodeFragmen.cdSum &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p selector &span <&em &span span 一CodeFragmen.cd)<&span                                     span 一SpeBeE">em>span skinshrfe-w-family: 'Calibri','sans-serif'p seq &span <&em &span span 一CodeFragmen.cd. &span span 一CodeFragmen.cdAverage &span span 一GramE"> span 一CodeFragmen.cd( &span em span skinshrfe-w-family: 'Calibri','sans-serif'p selector &span <&em &span span 一CodeFragmen.cd)<&span &p>v selector &em ieies in LIs, the members ofthe tblogs.#_Cysnow-_I-stance">cusnow- i-stance &a> for that sequencedoperatorareiautom v span 一SpeBeE">span 一GramE">customers.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p " span 一SpeBeE">Orders.Any &span (Total>= 1000)" &span ); &p>v

span 一SpeBeE">span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"sEnum &span &span span skinshrmso-fareast-fe-w-family: 'Timhu New Rocri'"s pt">Rsuph=de o:p &o:p &span &h2>v from a > ring literal to anspan 一SpeBeE">enum &span pt">Resovideddthe> ring literal e-tai-sdthenamsofa memberdofthat span 一SpeBeE">enum &span pt">. Foreiample, &p>v span 一SpeBeE">span 一GramE">orders.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p "span 一SpeBeE">Order ate.DayOfWeek<&span = \"Monday\"" &span ); &p>v is<&span equivalow- to &p>v span 一SpeBeE">span 一GramE">orders.Where &span &span span 一GramE">( &span span skinshrcolor: #a31515p "span 一SpeBeE">Order ate.DayOfWeek<&span = @0" &span , span 一SpeBeE">span skinshrcolor: #2b91afp ayOfWeek<&span .Monday &span ); &p>

&div>v
&div>v
v
&div>v
&div>v
v <&div>v
&div>v
&div>v <&div>v v v
2009-06-16 14:56&span tblogs'http://www.cnblogs.com/flysnow-z/'>Ryan.zhu &a> 阅读(span idpost_view_countcd... &span ) 评论(span idpost_commen._countcd... &span ) tblog ="https://i.cnblogs.com/EditPosts.aspx?postid1504338" lol="nofollow">编辑 &a> tblogs.#"doncl+xk="AddToWz(1504338);returr fals>;">收藏 & &div>v <&div>v