Ex : I have Two Collections like List
Integration above Collection and make a List
For this I am using Foreach and form the collection ,
But I need Linq Query to make the same scenario.
Can any one give me Idea on above Query?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Oct 19, 2011, 4:35 AM
VulpesPosted Dec 3, 2011, 8:49 AM
Please start a new thread if you want to ask a new question.
You'll have a better chance of getting a reply :)
Pulagara MuraliPosted Dec 3, 2011, 12:52 AM
I have one more query , how to pass parameters from Silverlight to Asp.net(without querystring and Initparameters)?
Could you give me any Idea?
Pulagara MuraliPosted Oct 19, 2011, 3:31 AM
Pulagara MuraliPosted Oct 19, 2011, 3:28 AM
I have a Collection like ServiceDetails. It Contains
Patient Object and Registration Object
ServiceDetail serviceDetail=new ServiceDetail ();
serviceDetail.Patient=new Patient();
serviceDetail.Registration=new Registration();
ServiceDetails(serviceDetail);
Above Is my Objct Formation.
In this case I have Two Other Collections Like 'Patients' and 'Registrations'
For above Object formation I wrote like below
List
foreach(ServiceDetail serviceItem in ServiceDetails)
{
//Bind Patient Object
serviceItem.Patient=Patients.where(i=>i.patientid==serviceItem.patientid)
.firstorDefault();
//Bind Registration Object
serviceItem.Registration=Registrations.where(i=>i.registrationId==serviceItem.registrationid)
.firstorDefault();
serviceDetails.add(serviceItem);
}
ServiceDetails=new List
For above collection formation I used one foreach. My query is I don,t used even one foreach also to make a Collection, instead of foreach I want to use Lamda expression or Linq Query .
Could you give any Idea on this Query Please?
VulpesPosted Oct 13, 2011, 5:05 AM
Jean PaulPosted Oct 13, 2011, 4:11 AM
I can provide a solution in which the above typed lists are casted to object.
(I believe the classes Registration and Patient are deriving from ServiceDetails)
If the classes are not having base as ServiceDetail, you may declare an implicit operator overloading like..
(but not sure it will fit the above code)
Regards,
JP