17 votes
Accepted

Simple object validator

Instead of using regular expressions to manipulate the expression string I prefer to do expression manipulation. While this can be a little daunting at first it turns out to be fairly simple. It ...
Corey's user avatar
  • 805
12 votes
Accepted

Building unusual IComparer<T> from expressions

...
Peter Taylor's user avatar
  • 24.1k
10 votes
Accepted

Selective updates to immutable types

You should be able to cut the code length and improve performance, by simplifying the algorithm. Here are some of the problems I've noticed in your implementation: You're currently processing all of ...
Denis's user avatar
  • 8,458
9 votes

Declarative type comparer

Very nice implementation; I always like seeing your code here. I really only have five very minor opinions on this implementation: I'm not sold on expr as an ...
Jesse C. Slicer's user avatar
8 votes

Building unusual IComparer<T> from expressions

I'd say this is far too complicated. It took me some time to figure out what those expressions are getting rewritten to, and the results do not look very efficient: ...
Pieter Witvoet's user avatar
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
7 votes
Accepted

Immutable builder and updater

You use IList<> where you should use ICollection<>. I've rarely encountered a scenario where ...
IEatBagels's user avatar
  • 12.4k
6 votes

Simple object validator

I just noticed a couple of small issues. First, IsValid(obj) may return true on null, whereas Validate(obj) has a special check ...
default.kramer's user avatar
6 votes
Accepted

Quiz for random boolean expressions

Very fun game you created here, I like it. Your calculations for the probabilities are also impressive, and well tested. Some small suggestions: UI improvement: Print a message when "leveling up". <...
Simon Forsberg's user avatar
5 votes

Simple object validator

Not much to say here. Your code looks clean and is easy to read. There is just a little bit what I would change, namely the "default" rule of the ...
Heslacher's user avatar
  • 50.4k
5 votes
Accepted

Something like a LINQ provider

I wouldn't worry too much about the amount of things that aren't supported (yet/if ever) - it's impossible to cover everything in a scenario like this. One thing I would suggest is that you throw ...
RobH's user avatar
  • 16.9k
5 votes

Calculate fingerprint for an object

Apart from the improvements suggested by Henrik Hansen and a couple of null checks I changed the list with tuples into SortedDictionary to avoid repetitive ...
t3chb0t's user avatar
  • 44.3k
5 votes

Building DebuggerDisplay strings

I'd personally like DebuggerDisplayHelper.ToString() to be an extension method, so I finagled it up as such: ...
Jesse C. Slicer's user avatar
5 votes
Accepted

Designing a basic Binary Expression Tree structure

While the expression tree is in fact a tree-structure, the elements in the tree are operators and operands. Using overly generic non-representative names makes it more difficult to follow the code. If ...
TorbenPutkonen's user avatar
4 votes

Declarative type comparer

That looks nice. A few notes: Enums can have different underlying types, and some are larger than int, which can result in subtle bugs. Use ...
Pieter Witvoet's user avatar
4 votes
Accepted

Simple generic sequence generators

It's a shame that you have to use such a complicated mechanism because the language doesn't support strong enough type constraints. Given the limitations of the language, this looks like an elegant ...
Peter Taylor's user avatar
  • 24.1k
4 votes

Simple object validator

I managed to rewrite most parts of it and I think it's much better now. It shouldn't be anything fancy, just a simple data validation helper that I guess most of the time will just check if something ...
t3chb0t's user avatar
  • 44.3k
4 votes

Simple object validator

Don't hang on to an IEnumerable ...
Johnbot's user avatar
  • 2,974
4 votes

Simple object validator with a new API

As developer consuming your API .. Usability I find this a verbose way of constructing validation rules. ...
dfhwze's user avatar
  • 13.9k
3 votes

Simple object validator

Nice work! One thing you could do is leverage polymorphism for the Validation class so that you have a separate type for Valid and Invalid results. And then you ...
Stephen Byrne's user avatar
3 votes

Simple generic sequence generators

One other suggestion is that the expression you are building don't change based on the value you pass into the constructors (besides GeometricSequence which you still could make a parameter instead of ...
CharlesNRice's user avatar
  • 4,343
3 votes
Accepted

Declarative type comparer

Since you are reading attributes I would put the work in the static constructor. That will run only once per type otherwise you should make the Create method lazy as there is no point in building the ...
CharlesNRice's user avatar
  • 4,343
3 votes

Parsing and evaluating cron expression

overall looks like a great job. Still, I wonder if you could save some CPU cycles with replacing Regex in favour of string ...
Bohdan Stupak's user avatar
3 votes
Accepted

GroupBy(params string[] fields)

Here are a few things I noticed: ...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

Extensions for setting members via expressions and reflection

This still looks fairly tedious: ...
Nikita B's user avatar
  • 13k

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