I am changing my 'old' code to LINQ and found it to be a big improvement. However, my knowledge of LINQ (v 3.5) is very basic but I need to solve just this one
point for my application to work.
Any suggestions will be appreciated.
Amien
Cape Town
South Africa.
IQueryable
select c;
foreach (var rec in AllDevices)
{
if (rec.isActive == true)
{
ucDevice ucf = new ucDevice(rec) // ???? - I want to pass the record 'r' to a function elsewhere but 'r' is type Var. In my old app, i used DataView/DataViewRow to pass the record but I want to use LINQ
}
}
// This is the function in another class expecting the record
public ucDevice (????) // Datatype of rec ??
{
InitializeComponent ();
{
// here I want to work with the 'record' I passed to this method.
}
}
Posted May 24, 2011, 2:06 AM
acrombiePosted May 24, 2011, 2:02 AM
Worked straight away. Thanks a million for the speedy reply.
Your answer also explains some of my other LINQ questions.
Enjoy the IPL...
Amien
Posted May 24, 2011, 1:51 AM
In the for-each also you can the var to type of AllDevice.
IQueryable
select c;
foreach (AllDevice rec in xDevice )
{
if (rec.isActive == true)
{
ucDevice ucf = new ucDevice(rec) // ???? - I want to pass the record 'r' to a function elsewhere but 'r' is type Var. In my old app, i used DataView/DataViewRow to pass the record but I want to use LINQ
}
}
// This is the function in another class expecting the record
public ucDevice (AllDevice device) // Datatype of rec ??
{
InitializeComponent ();
{
// here I want to work with the 'record' I passed to this method.
}
}
Hope this helps you.
Posted May 24, 2011, 1:48 AM
{
if (rec.isActive == true)
{
ucDevice ucf = new ucDevice(rec) // ???? - I want to pass the record 'r' to a function elsewhere but 'r' is type Var. In my old app, i used DataView/DataViewRow to pass the record but I want to use LINQ
}
}
// This is the function in another class expecting the record
public ucDevice (AllDevice device) // Datatype of rec ??
{
InitializeComponent ();
{
// here I want to work with the 'record' I passed to this method.
}
}
Try this way...