summaryrefslogtreecommitdiff
path: root/BCT/Samples/Generics
diff options
context:
space:
mode:
authorGravatar 10shb <unknown>2011-05-12 09:56:11 +0530
committerGravatar 10shb <unknown>2011-05-12 09:56:11 +0530
commit746c28cd03e8840e8525352ff2aebcfeb76ca2a1 (patch)
treef09450daf5427605cdfe60d42bc7aac78f422278 /BCT/Samples/Generics
parenta1affe2114ae22816cf72d14fb4ae357a64fe7f2 (diff)
added examples of generics and string support needed by Poirot
Diffstat (limited to 'BCT/Samples/Generics')
-rw-r--r--BCT/Samples/Generics/GenericsExample.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/BCT/Samples/Generics/GenericsExample.cs b/BCT/Samples/Generics/GenericsExample.cs
new file mode 100644
index 00000000..c7016ceb
--- /dev/null
+++ b/BCT/Samples/Generics/GenericsExample.cs
@@ -0,0 +1,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
+ }
+} \ No newline at end of file