Jacob Carpenter’s Weblog

June 18, 2008

.Any overload

Filed under: Uncategorized — Jacob @ 4:12 pm

Nice:

if (folderPaths.Any(path => !Directory.Exists(path)))
    throw new DirectoryNotFoundException();

Nicer:

string pathNotFound;
if (folderPaths.Any(path => !Directory.Exists(path), out pathNotFound))
    throw new DirectoryNotFoundException("Could not find path: " + pathNotFound);

The implementation of

    public static bool Any<T>(this IEnumerable<T> source,
        Func<T, bool> predicate, out T found)

left as a trivial exercise to the reader.

June 16, 2008

Hello, world!

Filed under: Uncategorized — Jacob @ 9:12 am

Jonas Adam Carpenter

Jonas Adam Carpenter; born June 4th @ 6 lbs. 3 oz., 19 in.

(Sorry for the entirely non-technical post. I’ll be blogging more C# again, soon.)

Create a free website or blog at WordPress.com.