summaryrefslogtreecommitdiff
path: root/BCT/Samples/Exceptions/ExceptionsExample.cs
blob: 5efb69b78a96eb7c33d4185007742fa1fac57327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Threading;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

/* Simple example of exception support needed by Poirot */

class PoirotMain
{

    public static void foo()
    {
        throw new Exception("Error");
    }

    public static void Main()
    {
        int x = 5;
        try
        {
            foo();
            x = 17;
        }
        catch (Exception e)
        {
            x = 34;
        }
        Contract.Assert(x == 35);
    }
}