blob: c7016ceb4c5359be4be2dc89e53d63ac58677535 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
/* Simple example of generics/dictionary support needed by Poirot */
class GenericsExample
{
public static void Main()
{
Dictionary<String, String> dict = new Dictionary<String, String>();
dict["foo"] = "bar";
Contract.Assert(dict.ContainsKey("foo"));
Contract.Assert(dict.ContainsValue("bar"));
Contract.Assert(dict["foo"] == "bar");
dict.Remove("foo");
Contract.Assert(dict["foo"] == "bar"); // should fail
}
}
|