Questions tagged [linq-expressions]

An API for composing code with declarative expression trees, used by LINQ and the DLR.

Filter by
Sorted by
Tagged with
0 votes
1 answer
4k views

Merging every two objects into single single object making group by a property C# LINQ [closed]

I have a object list like below. I want to join every two rows into single row based on column B. It is sure that only two rows would be there for every single column B value. Input Output However, ...
Rahul's user avatar
  • 101
4 votes
1 answer
5k views

A simple method to execute Entity Framework Core queries in parallel

As you might know, EF Core does not support executing multiple queries in parallel on the same context using something like Task.WhenAll. So you have to write this ...
wertzui's user avatar
  • 188
14 votes
2 answers
4k views

Expression Conversion

Using Entity Framework we have a number of entities, which we want to hide from the rest of the calling code to remove the direct dependency on the database. We're doing so by using DTOs, which for ...
JChristen's user avatar
  • 243
1 vote
4 answers
6k views

Chain LINQ expressions for filtering

Example of my method where I am chaining linq expressions based on model values provided: ...
sensei's user avatar
  • 286
1 vote
3 answers
598 views

Get a collection of child positions for a given parent position

I am trying to get a complete tree in a single loop using an iterative function. For instance, this is what I have: ...
vikramjb's user avatar
  • 121
4 votes
1 answer
8k views

Change UI display order of an ObservableCollection

I have an ObservableCollection that is filled with custom elements of type Video runtime. These have the properties of Name, Rating and Number of Viewers. I want to ...
oneManArmin's user avatar
2 votes
1 answer
128 views

Group a list of products and services

I'm working with a third part service of my client that is providing me a list of products and services, which is a little bit of a mess. The list will return all of the ...
Ariel's user avatar
  • 145
11 votes
2 answers
11k views

Generate a LINQ Expression Tree from a filter string

I have a C# Service that takes a filter string and a FilterMap class and generates an Expression<Func<T, bool>> for ...
Seaal's user avatar
  • 163
5 votes
1 answer
178 views

Calculating user efficiency on a time period with Linq

I have this expression: ...
sDima's user avatar
  • 849
2 votes
2 answers
141 views

Method for validating properties based on passed conditions

I wrote a method for validating properties based on passed conditions. It works well, but declaration takes more space than the actual condition. Is there any way to make it shorter? ...
FCin's user avatar
  • 205
6 votes
1 answer
1k views

IQueryable Extensions working on expression for collection property

Followup to Repository searching code duplication My goal currently is to make the current implementation of my repository's IQueryable filtering less duplicative. First, I looked into passing ...
Chris Thompson's user avatar
7 votes
1 answer
331 views

LINQ Provider: Supporting Projections

Up until recently, my LINQ-to-Sage provider didn't support projections, so the client code had to explicitly "transfer" to LINQ-to-Objects, like this: ...
Mathieu Guindon's user avatar
10 votes
3 answers
2k views

Tracking Entity Changes (not EF)

So, I kept refactoring my Sage300 API wrapper - I wanted the client code to feel just like using Entity Framework - this is the closest I got to it: ...
Mathieu Guindon's user avatar