Hi
In below code i want to order by name
var Result = (from t2 in context.View_SessionDeliveryCalendarDetails_Students
select new { t2.StudentID, Name = t2.Name + " - " + t2.MobileNo }).Distinct().ToList();
Thanks
Amit MohantyPosted Apr 7, 2023, 11:18 AM
Raj BhattPosted Apr 8, 2023, 4:35 AM
Hi You can Try Below Code
For Ascending order
For Descending order
Tuhin PaulPosted Apr 7, 2023, 6:40 PM
Although query syntax is useful for writing more declarative and readable queries, method syntax can sometimes be more concise and easier to read.
Tuhin PaulPosted Apr 7, 2023, 6:36 PM
Instead of using the + operator to concatenate strings, you can use string interpolation to make the code more concise and easier to read
Tuhin PaulPosted Apr 7, 2023, 6:34 PM
Instead of using generic names like t2, consider using names that more accurately describe the purpose of the variables. In this case, you could use names like student or calendarDetail.
Naimish MakwanaPosted Apr 7, 2023, 11:44 AM
Try below:
Jignesh KumarPosted Apr 7, 2023, 11:19 AM
Hello Ramco,
use below one,