From: roberta on 8 May 2010 17:07 I've this code Dipendente myDipendente = new Dipendente(); myDipendente = DipendenteManager.GetItem(IDDipendente, true, true, true, true); Now in myDipendente.Elenco I've an ElencoCollection Now I would like to verify if in my collection (Elenco) there is, for the field Elenco.ID the value 10... is it possible? Thanks
From: Mr. Arnold on 8 May 2010 20:43 roberta wrote: > I've this code > > Dipendente myDipendente = new Dipendente(); > myDipendente = DipendenteManager.GetItem(IDDipendente, true, > true, true, true); > > Now in > > myDipendente.Elenco I've an ElencoCollection > > Now I would like to verify if in my collection (Elenco) there is, for > the field Elenco.ID the value 10... is it possible? > > Thanks Yes you can query the collection using Linq. var myobject = (from a in myDipendente.Elenco where a.ID == 10 select a).firstordefault(); if (myobject != null) { var id = myobject.ID; } http://en.wikipedia.org/wiki/Language_Integrated_Query
From: Harlan Messinger on 8 May 2010 21:12 Mr. Arnold wrote: > roberta wrote: >> I've this code >> >> Dipendente myDipendente = new Dipendente(); >> myDipendente = DipendenteManager.GetItem(IDDipendente, true, >> true, true, true); >> >> Now in >> >> myDipendente.Elenco I've an ElencoCollection >> >> Now I would like to verify if in my collection (Elenco) there is, for >> the field Elenco.ID the value 10... is it possible? >> >> Thanks > > Yes you can query the collection using Linq. > > var myobject = (from a in myDipendente.Elenco where a.ID == 10 select > a).firstordefault(); > > if (myobject != null) > { > var id = myobject.ID; > > } > > http://en.wikipedia.org/wiki/Language_Integrated_Query With names like myDipendente and DipendenteManager and ElencoCollection, there's already a lot of language integration going on.
From: roberta on 9 May 2010 10:04 Can you tell me how Can I do this without using Linq? Thanks
From: Mr. Arnold on 9 May 2010 14:06 roberta wrote: > Can you tell me how Can I do this without using Linq? > > Thanks You make a bool function put into a foreach loop on the collection until you get the hit I guess.
|
Pages: 1 Prev: WordMerge Next: Net 1.1/2.0 and authentication against oracle |