NetMage
  • Member for 10 years, 6 months
  • Last seen more than a month ago
Refactoring and creating separate methods
Accepted answer
7 votes

I think you are running into a fundamental problem I often have with anonymous types: they are anonymous. C++0x has some interesting extensions for getting types back from anonymous types, though I am ...

View answer
Code to initialize a .NET object from a CSV file
6 votes

Here is another answer, using Reflection, Expression and Attribute to create a more automated solution. First you create a couple of custom Attributes to mark fields or properties with the CSV Header ...

View answer
Code to initialize a .NET object from a CSV file
3 votes

I am not sure if Reflection wouldn't be the ultimate solution (you would need to use a custom attribute to indicate non-matching CSV headers), but one possibility is to manually create a map for ...

View answer
Extracting member-accesses from an expression in C#
1 votes

What if you nested the MemberExpressionVisitor class inside another class? Since I like extension methods, create a static class that contains an extension method on Expression<Func<T,TRes>&...

View answer
Given an arbitrarily large file containing integers, return the largest N numbers, highest first
1 votes

Consider remembering the n largest numbers: def top_n(filename, n = 100) require 'set' topn = SortedSet.new() File.foreach(filename) do |line| num = line.to_i if topn....

View answer
LinQ wrapper to get distinct items from a IEnumerable based on a function of item
Accepted answer
1 votes

That is a good definition for an IQueryable but I believe it is better to implement the operation directly for an IEnumerable (note: I don't use VB, so translated from C#): <Extension()> Public ...

View answer
LINQ to SQL query filter, with the name match ignoring multiple punctuation characters
0 votes

Here's a generic solution I created to solve these sorts of issues, and the specifics for this particular one. It uses an Attribute class to mark methods (normally extension methods) as needing ...

View answer
Grouping by sequence in LINQ
0 votes

Since I was looking at similar functionality for runs of sequential numbers, I thought I'd offer my LINQ solution to this. Using an extension method based on the APL scan operator, which is something ...

View answer
Concise null checking vs readability
0 votes

I think the concise version is longer and more confusing, and emphasizes the wrong return (assuming the value of SomeProperty is what is really of interest). For the verbose, I don't like returning ...

View answer