Skip to main content
8 votes
Accepted

Expression Conversion

You could use the ExpressionVisitor class to give yourself some more flexibility and not have to handle all the conditions yourself. ...
CharlesNRice's user avatar
  • 4,408
7 votes

Calculating user efficiency on a time period with Linq

Don't one line things that shouldn't be one lined. Just because you can do something, doesn't mean that you should. Extract the duplicated query into a method of it's own that returns an ...
RubberDuck's user avatar
  • 30.8k
5 votes
Accepted

Method for validating properties based on passed conditions

The class encapsulating the two properties suggested by @eurotrash is definitely a good idea. I think name ValidationRule should be ok. ...
t3chb0t's user avatar
  • 44.3k
4 votes
Accepted

Change UI display order of an ObservableCollection

To sort your ObservableCollection you should be using data-binding and let WPF do the work. First let's fix the ComboBox that ...
t3chb0t's user avatar
  • 44.3k
4 votes

Generate a LINQ Expression Tree from a filter string

internal abstract class BaseFilterType<T> The GetPropertyExpression() just got into my eyes asking myself what all of ...
Heslacher's user avatar
  • 50.4k
3 votes

Expression Conversion

Can I say first off - this is excellent - both the post and the provided answer. I tool follow a similar pattern of surfacing a DTO through my controllers and abstracting away my data access. I ...
JDBennett's user avatar
  • 131
3 votes

Chain LINQ expressions for filtering

You have such properties as ExerciseFilter and DateFilter that I guess return respecitively the ...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

Get a collection of child positions for a given parent position

If Position and Position() in your code is the same and you supposed to call GetChildPos ...
Maxim's user avatar
  • 2,542
3 votes
Accepted

Generate a LINQ Expression Tree from a filter string

Good things Everything is nicely encapsulated and each class has only one responsibility. Not only the big ones but also the small ones like RawFilterParts or <...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

LINQ Provider: Supporting Projections

One of the things I think when I see a large case statement is would this be better off as some kind of lookup table. I think yours might have some scope for doing this since they all seem to do some ...
forsvarir's user avatar
  • 11.7k
3 votes

Method for validating properties based on passed conditions

Basically I want to get rid of: new Tuple<Expression<Func<bool>>, string> Create your own class instead of the lengthy Tuple? ...
404's user avatar
  • 2,306
2 votes
Accepted

IQueryable Extensions working on expression for collection property

I have worked out the typings and expressions required to extract the common logic that was being duplicated in numerous places. Lines like this: ...
Chris Thompson's user avatar
2 votes

Get a collection of child positions for a given parent position

What really would speed this up would be to store the result of serviceRepo.Position().GetAll() into a variable and pass this as an argument to the desired method. ...
Heslacher's user avatar
  • 50.4k
2 votes

Get a collection of child positions for a given parent position

I think @Maxim's answer should yield a reasonable improvement and as mentioned in the comment you could pass in the Position object directly saving a call to ...
ChrisWue's user avatar
  • 20.3k
2 votes
Accepted

A simple method to execute Entity Framework Core queries in parallel

All public API surfaces should validate input parameters. Restricting the queries to a single entity type seems limiting. You can't join entities with no navigation properties. It fails when using ...
Johnbot's user avatar
  • 2,974
1 vote

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

If you want to reduce the iteration to get the value for ColumnC and ColumnD and make the code cleaner, you can try using Aggregate instead. ...
Moch Yusup's user avatar
1 vote

Chain LINQ expressions for filtering

One of the things that I find jarring is that your model contains properties such as ExerciseFilter (the filter value), but the ...
Flater's user avatar
  • 5,542
1 vote

Chain LINQ expressions for filtering

You could abstract a ConditionalFilter to be used in a list with LINQ instead of writing many if statements: ...
JanDotNet's user avatar
  • 8,538
1 vote

Chain LINQ expressions for filtering

Seems you could simplify it to just be this. Takes 3 if to 2 and I feel reads better. ...
CharlesNRice's user avatar
  • 4,408
1 vote
Accepted

Group a list of products and services

There are some improvemants possible but they are rather of technical nature then about performance as I don't think you can do much about it until you have measured it either with benchmarks or a ...
t3chb0t's user avatar
  • 44.3k

Only top scored, non community-wiki answers of a minimum length are eligible