4
Answers

Passing a record to a function using IQueryable

Ask a question
acrombie

acrombie

13y
2k
1
Here is my code :
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<AllDevice> xDevice = from c in dbC.AllDevices
                                             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.
  }

}

Answers (4)