giovedì 18 marzo 2010

Fast C# Assert

How to implement an "assert" facility in C#, quick and easy:


    public class Assert
    {
        public static void Check(bool value)
        {
            if (!value) throw new AssertionFailedException();
        }
    }

    public class AssertionFailedException : Exception
    {
    }

Nessun commento: