multi parameter

patrick

Well-known member
Joined
Dec 5, 2021
Messages
269
Programming Experience
1-3
Hello

C#:
class Person
{
   public string ID;
   public string Name;
}

Ienumerable<Person> ps= lst.Where(n=>n.ID anf n=>n.Name)

string str = " Where ID = 1 and Name= 'joue' ;

Ienumerable <Person> ps=
lst.Where(str)

Ienumerable<Person> ts=
ps.Orderby(r=>r.ID and r=>r.Name)

string str1 = " Orderby ID, Name ";

Ienumerable  ts = ps.Orderby(str1);

can linq accept string input???
 
Last edited:
If you sorted a list of persons by their id and number, you would still get a list of persons. Why would sorting change the objects themselves? All sorting does is rearrange the order of the objects, hence the name of the method: OrderBy().
 
If you sorted a list of persons by their id and number, you would still get a list of persons. Why would sorting change the objects themselves? All sorting does is rearrange the order of the objects, hence the name of the method: OrderBy().


Return type is IENUMERABLE<PERSON>

In code, using system.linq.dynamic; reference to as.

In code, using system.linq removed

But, system.linq.dynamic is not recognized.

I using sylvan
 
Last edited:
If you look at the documentation, LINQ Extension methods almost always return IEnumerable<T> (if not IQueryable<T>. So why are you surprised that Dynamic Linq is also returning IEnumerable<T>? What do you want it to return?
 
If you look at the documentation, LINQ Extension methods almost always return IEnumerable<T> (if not IQueryable<T>. So why are you surprised that Dynamic Linq is also returning IEnumerable<T>? What do you want it to return?
thank you .
 
Back
Top Bottom