2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-339.cs
blob6165a10b7bde758ffc64c494bed229601167687c
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
5 class Program
7 static void Main ()
9 SerializeDictionary (new SerializerLazyDictionary ());
12 static void SerializeDictionary (IDictionary values)
16 static void SerializeDictionary (IDictionary<string, object> values)
21 sealed class SerializerLazyDictionary : LazyDictionary
23 protected override IEnumerator<KeyValuePair<string, object>> GetEnumerator ()
25 return null;
29 internal abstract class LazyDictionary : IDictionary<string, object>
31 void IDictionary<string, object>.Add (string key, object value)
33 throw new NotSupportedException ();
36 bool IDictionary<string, object>.ContainsKey (string key)
38 throw new NotSupportedException ();
41 ICollection<string> IDictionary<string, object>.Keys
43 get { throw new NotSupportedException (); }
46 bool IDictionary<string, object>.Remove (string key)
48 throw new NotSupportedException ();
51 bool IDictionary<string, object>.TryGetValue (string key, out object value)
53 throw new NotSupportedException ();
56 ICollection<object> IDictionary<string, object>.Values
58 get { throw new NotSupportedException (); }
61 object IDictionary<string, object>.this [string key] {
62 get {
63 throw new NotSupportedException ();
65 set {
66 throw new NotSupportedException ();
70 void ICollection<KeyValuePair<string, object>>.Add (KeyValuePair<string, object> item)
72 throw new NotSupportedException ();
75 void ICollection<KeyValuePair<string, object>>.Clear ()
77 throw new NotSupportedException ();
80 bool ICollection<KeyValuePair<string, object>>.Contains (KeyValuePair<string, object> item)
82 throw new NotSupportedException ();
85 void ICollection<KeyValuePair<string, object>>.CopyTo (KeyValuePair<string, object> [] array, int arrayIndex)
87 throw new NotSupportedException ();
90 int ICollection<KeyValuePair<string, object>>.Count
92 get { throw new NotSupportedException (); }
95 bool ICollection<KeyValuePair<string, object>>.IsReadOnly
97 get { throw new NotSupportedException (); }
100 bool ICollection<KeyValuePair<string, object>>.Remove (KeyValuePair<string, object> item)
102 throw new NotSupportedException ();
105 IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator ()
107 return GetEnumerator ();
110 protected abstract IEnumerator<KeyValuePair<string, object>> GetEnumerator ();
112 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
114 return ((IEnumerable<KeyValuePair<string, object>>) this).GetEnumerator ();