diff options
author | jbevain <jbevain@gmail.com> | 2010-09-22 02:27:23 +0400 |
---|---|---|
committer | jbevain <jbevain@gmail.com> | 2010-09-22 02:27:23 +0400 |
commit | 6314230d91da95085bbd31dbd2b7c664dc546eb2 (patch) | |
tree | a6a31d6d9d2b03694ad0e9d17d4d1bbd33923128 /Mono.Collections.Generic | |
parent | 326a159ff116da085ea9e5bc0210ae5157a508d9 (diff) |
Simplify ReadOnlyCollection
Diffstat (limited to 'Mono.Collections.Generic')
-rw-r--r-- | Mono.Collections.Generic/ReadOnlyCollection.cs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Mono.Collections.Generic/ReadOnlyCollection.cs b/Mono.Collections.Generic/ReadOnlyCollection.cs index 61f6912..be686a4 100644 --- a/Mono.Collections.Generic/ReadOnlyCollection.cs +++ b/Mono.Collections.Generic/ReadOnlyCollection.cs @@ -39,26 +39,21 @@ namespace Mono.Collections.Generic { get { return empty ?? (empty = new ReadOnlyCollection<T> ()); } } - readonly bool initialized; - bool IList.IsReadOnly { get { return true; } } - public ReadOnlyCollection () + private ReadOnlyCollection () { - initialized = true; } public ReadOnlyCollection (T [] array) - : this () { this.items = array; this.size = array.Length; } public ReadOnlyCollection (Collection<T> collection) - : this () { this.items = collection.items; this.size = collection.size; @@ -66,14 +61,12 @@ namespace Mono.Collections.Generic { internal override void Grow (int desired) { - if (initialized) - throw new InvalidOperationException (); + throw new InvalidOperationException (); } protected override void OnAdd (T item, int index) { - if (initialized) - throw new InvalidOperationException (); + throw new InvalidOperationException (); } protected override void OnClear () |