how to access one class property in another class linq

nrjc

New member
Joined
Feb 25, 2012
Messages
1
Programming Experience
1-3
i have a variable

int principleIndex = Principles.Instance.RowIndexToPrincipleIndex(hti.Row);

i want to use in another class linq query

principlesList.Select(p => p.GetInstanceForDatabase()).where(p=>p.prinicpleindex ).ToList(),

how do i do it ???
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,271
Location
Sydney, Australia
Programming Experience
10+
You don't. If that LINQ code is in another class then you will need a variable in that class. You would then pass the value in to that variable in whatever way is appropriate. That might be as an argument to the class constructor or some other method, including the method containing the LINQ code, or it might be by setting a property.
 
Top Bottom