Wednesday, April 30, 2008
Simon Green posted a good comment on a previous post of mine (I like Guids), which is a generic class that wraps Guids, so that you get a nice compile time error if the wrong guid is used in the wrong place.

e.g.

/* Doesn't compile
Library.BorrowBook(bookId, personId);
*/

// Compiles fine
Library.BorrowBook(personId, bookId);

Whereas with a normal signature of (Guid, Guid) you'd get no compile-time error if the parameters were mixed up.

Try his solution out, and let me know what you think.

Cheers,

Kirk

Comments are closed.