What?

The Helper Trinity is a set of helper classes applicable to most any .NET application. Using the classes in this library, you can much more easily validate arguments, raise events, and throw exceptions.

Why?

Writing code to check arguments, raise events, and throw exceptions is mundane and error-prone. The Helper Trinity alleviates you of the need to write such code over and over again.

Where?

Documentation, binaries, and source for The Helper Trinity can be downloaded from the releases section.

How?

private static readonly ExceptionHelper _exceptionHelper = new ExceptionHelper(typeof(MyType));

public event EventHandler<EventArgs> GettingContent;

public string GetContent(Uri uri, ContentFormat format)
{
    //validate arguments
    uri.AssertNotNull("uri");
    format.AssertEnumMember("format");

    //validate environment
    _exceptionHelper.ResolveAndThrowIf(!ConnectedToInternet, "NotConnected");

    //raise an event
    GettingContent.Raise(this, EventArgs.Empty);

    try
    {
        //get and return the content
        ...
    }
    catch (WebException ex)
    {
        //throw a more appropriate exception
        throw _exceptionHelper.Resolve("InvalidState", ex);
    }
} 
Please see the wiki documentation and download the API documentation and source for many more examples.

Who?

The Helper Trinity is currently developed solely by Kent Boogaart.

Primary Features

  • Easily check arguments and throw the appropriate exception type where expectations are not met
  • Easily raise events in a thread-safe manner
  • Easily throw exceptions and maintain exception messages in a centralized location
  • .NET 3.5 extension methods to make argument checking and event raising even simpler
  • Support for checking generic arguments
  • Built with performance in mind
  • Extensively unit tested
  • Runs on mono
Last edited Nov 22 2009 at 11:13 PM by kentcb, version 14

 

Want to leave feedback?
Please use Discussions or Reviews instead.

Updating...
© 2006-2010 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2010.1.12.16187