From: roberta on
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
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
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
Can you tell me how Can I do this without using Linq?

Thanks
From: Mr. Arnold on
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.