This page highlights a few notable types you can find inside the common class library. The library is used throughout my projects and can be considered as stable and tested.


Format exceptions into a nicely readable format.

// sample output:
=======================================================(inner most exception)===
 (1) System.ApplicationException
Method        :  Test_FormatException
Type          :  Amarok.Test_Helper
Assembly      :  tests.amarok.common, Version=9.99.9999.0, Culture=neutral, PublicKeyToken=8104e84e2269272c
Assembly Path :  D:\framework\bin\net45\tests.amarok.common.dll
Source        :  tests.amarok.common
Helplink      :  


value = "123.456"

Stack Trace:
   at Amarok.Test_Helper.Test_FormatException() in d:\framework\src\tests.amarok.common\Foundation\Utilities\Test_Helper.cs:line 104


Public methods should check incoming arguments. Argument validation is important, especially for libraries.
public void SomeMethod(String text, Int32 length)
  Verify.NotEmpty(text, "text");
  Verify.NotNegative(length, "length");

  // your logic

Other Types

  • DisposableObject: A light-weight and thread-safe base class for types that need to implement the dispose pattern.
  • BufferSegment: A type for working with byte arrays. You can append buffer segments and discard segments. Useful for implementing binary protocol parsers.
  • Helper: A static type with various helper methods for any kind of purpose.

Last edited May 10, 2012 at 8:07 PM by OlafKober, version 5


No comments yet.