Thursday, February 16, 2006

Some utilities for .Net development

I've had several requests for a package of my various code snippets. I'm releasing these for anyone to use [download here].

Some are based on prior postings, some are things I've gathered from across the net for other projects, some are even things I wrote myself. Everything is packaged as a single Assembly. This code requires at least .Net 2.0 and is in C#.

  • There is one class Utilites which is a partial class containing a ton of String, Double, DateTime, HTML, and serialization helper methods. This class is marked partial, so you can add members anytime.
  • There is the ArgumentValidation class mentioned here.
  • There is the DynamicComparer and SortProperty class mentioned here.
  • Finally there are UndoableAction and DisposableAction inspired by a cool posting by Oren Eini here

If you make any improvements or have any comments, please let me know.

UPDATED: On 9 March, 2008 I updated the Utilities library to include fixes in my CombineHashCodes methods.

2 comments:

Anonymous said...

Some useful stuff in there.

Off hand, if I were to use some of it I would have to change some things to globalize them.

IsAlpha() and IsDecimal(), for example assume a North American locale. I would probably make use of Char.IsLetter(), Char.IsDigit(), NumberFormatInfo.NumberDecimalSeparator, NumberGroupSeparator, etc.

And, just for my curiousity: was DateTime.IsLeapYear() avoided for a specific reason?

IDisposable said...

Yeah, the context I used those tools in was US only... definately can put in much better RegEx values.

DateTime.IsLeapYear I thinkI needed static method for databinding use. I don't remember :)