-Subproject commit ad88839b1434e351bfd1b768c5d39e1a831a58d1
+Subproject commit 795f45a8eb7b1434861747d9b5e20e3bb60439e5
resources/collation.cjkKO.bin \
resources/collation.cjkKOlv2.bin
-REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK
+REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES
LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618 -d:INSIDE_CORLIB -d:LIBC $(REFERENCE_SOURCES_FLAGS)
DEFAULT_REFERENCES =
+++ /dev/null
-2010-06-29 Marek Safar <marek.safar@gmail.com>
-
- * List.cs: Optimize IEnumerable<T> ctor.
-
-2010-05-15 Marek Safar <marek.safar@gmail.com>
-
- * KeyValuePair.cs: Initialize fields definitely.
-
-2010-03-19 Sebastien Pouliot <sebastien@ximian.com>
-
- * CollectionDebuggerView.cs: Change to internal so we can avoid
- a duplicating the type in assemblies that have [InternalsVisibleTo]
-
-2010-01-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
-
- * EqualityComparer.cs: (Equals) the arguments are checked to be
- the correct type.
-
-2010-01-24 Robert Jordan <robertj@gmx.net>
-
- * Dictionary.cs: Fix deserialization compatibility with MS.NET.
- Fixes bug #474009.
-
-2010-01-20 Miguel de Icaza <miguel@novell.com>
-
- * Dictionary.cs: Always create the keys, fixes compatibility
- between Mono and .NET. Patch from John Lenz <jlenz2@math.uiuc.edu>
-
-2009-12-06 Chris Toshok <toshok@ximian.com>
-
- * KeyValuePair.cs: we need setters for Key and Value so they can
- be set via reflection from
- System.ServiceModel.System.Runtime.Serialization.Json.TypeMap.cs.
-
-2009-11-26 Marek Safar <marek.safar@gmail.com>
-
- * CollectionDebuggerView.cs: Removed limit restriction.
-
-2009-11-23 Carlos Alberto Cortez <calberto.cortez@gmail.com>
-
- * Comparer.cs: Our DefaultComparer class should be serializable just
- as the generic one is.
- Fixes #503585.
-
-2009-11-23 Juraj Skripsky <js@hotfeet.ch>
-
- * List.cs (Sort): Call more appropriate overload of Array.Sort<T>.
- Array.Sort<T> should be able to determine the comparison itself.
- Speeds up the sorting for items of primitive type.
- Fixes #530450.
-
-2009-11-08 Juraj Skripsky <js@hotfeet.ch>
-
- * List.cs (Sort): Sync to latest changes in Array.Sort.
-
-2009-10-20 Marek Safar <marek.safar@gmail.com>
-
- * List.cs, CollectionDebuggerView.cs, KeyValuePair.cs, Dictionary.cs
- Improve debugging experience.
-
-2009-10-19 Marek Safar <marek.safar@gmail.com>
-
- * CollectionDebuggerView.cs: New file.
-
-2009-10-17 Sebastien Pouliot <sebastien@ximian.com>
-
- * EqualityComparer.cs: Seal internal classes
-
-2009-10-02 Raja R Harinath <harinath@hurrynot.org>
-
- * Dictionary.cs (Do_ICollectionCopyTo): Revert 2009-10-01 change.
- Use BOOTSTRAP_BASIC to hide code from gmcs 2.4.x.
-
-2009-10-01 Marek Habersack <mhabersack@novell.com>
-
- * Dictionary.cs: cast target array to TRet[] instead of object[] -
- may fail, but otherwise it doesn't compile with 2.4 (e.g. when
- bootstrapping trunk)
-
-2009-09-22 Raja R Harinath <harinath@hurrynot.org>
-
- Ensure that invalid arrays to CopyTo result in ArgumentExceptions.
- * Dictionary.cs (CopyToCheck, Do_CopyTo): Carve out of ...
- (CopyTo): ... this.
- (Do_ICollectionCopyTo): Carve out of ICollection.CopyTo. Convert
- type-cast exceptions to ArgumentExceptions.
- (KeyCollection.CopyTo): Use them.
- (ValueCollection.CopyTo): Use them.
-
-2009-07-31 Raja R Harinath <harinath@hurrynot.org>
-
- * List.cs (IList.this.set): Convert NullReference and InvalidCast
- exceptions into ArgumentExceptions.
- (IList.Add, IList.Contains, IList.IndexOf, IList.Insert, IList.Remove):
- Convert NullReferenceException to ArgumentException.
-
-2009-07-31 Raja R Harinath <harinath@hurrynot.org>
-
- * List.cs (Enumerator.next): Rename from Enumerator.idx and change
- meaning to be the index of the next item to be enumerated.
- (Enumerator.MoveNext): Simplify.
-
-2009-07-31 Raja R Harinath <harinath@hurrynot.org>
-
- * Dictionary.cs (Enumerator.next): Rename from Enumerator.cur and
- change meaning to be the index of the slot to start searching on
- the next iteration.
- (Enumerator.MoveNext): Avoid an out-of-bounds access.
-
-2009-07-30 Raja R Harinath <harinath@hurrynot.org>
-
- * List.cs (Enumerator.current): New.
- (Enumerator.MoveNext): Update it.
- (Enumerator.Current): Don't verify any invariants.
- (Enumerator.Dispose): Set 'l' to null.
-
-2009-07-29 Raja R Harinath <harinath@hurrynot.org>
-
- * Dictionary.cs (Enumerator.current): New.
- (Enumerator.MoveNext): Update it.
- (Enumerator.Current): Don't verify any invariants.
-
-2009-06-10 Marek Safar <marek.safar@gmail.com>
-
- * IEqualityComparer.cs, IComparer.cs, IEnumerable.cs,
- IEnumerator.cs: Add type variance.
-
-2009-04-02 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs (ValueCollection.CopyTo): fix for copying to
- an object array. Based on a patch by Tobias Grimm <mono@e-tobi.net>.
- Fixes bug #328036.
-
-2009-02-04 Zoltan Varga <vargaz@gmail.com>
-
- * Dictionary.cs: Declare the Link struct outside the main class to avoid
- creating a separate inflated instances for each instantiation of Dictionary.
-
-2008-11-14 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs (ICollection.CopyTo): fix the different possible
- copying cases depending on the actual type of destination array,
- be it an array of KeyValuePair, DictionaryEntry, or object.
- Fixes #444778.
-
-2008-11-14 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs: fix ICollection<KeyValuePair<T>>.Remove and .Contains
- to not only check if the key exists but if the associated value is the
- good one as well. Fixes #444768.
-
-2008-10-06 Zoltan Varga <vargaz@gmail.com>
-
- * Dictionary.cs (Clear): Clear the linkSlots array as well, as
- Enumerator.MoveNext () depends on it. Fixes #432441.
-
-Fri Oct 3 23:08:06 CEST 2008 Paolo Molaro <lupus@ximian.com>
-
- * Dictionary.cs: by popular demand, return keys/values in insertion
- order when possible.
-
-2008-09-29 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs: check for null argument in ContainsKey.
- Patch by Jonathan Anderson <jonathan.l.anderson@gmail.com>
-
-2008-09-24 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs: properly reset all compounds enumerators.
- Fixes #429530.
-
-2008-09-12 Jb Evain <jbevain@novell.com>
-
- * Dictionary.cs: (ToTValue) allow null values to be added for non
- value types TValues to the dictionary when using the
- non generic IDictionary. Fixes #425693.
-
-2008-06-16 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
-
- * String.cs: Dictionary: Do not change the index data when using the indexer for
- an already existing index. This is somewhat illogical and breakes obscure code situations
-
-2008-05-29 Juraj Skripsky <js@hotfeet.ch>
-
- * List.cs (RemoveAll, Shift): Fix leak by clearing empty array
- items.
-
-2008-04-29 Juraj Skripsky <js@hotfeet.ch>
-
- * Dictionary.cs (Clear, Remove): Clear empty slots in keySlots
- and valueSlots. Otherwise the garbage collector cannot reclaim
- the referenced key/value. Fixes bug #384723.
-
-2008-04-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
-
- * KeyNotFoundException.cs
- * KeyValuePair.cs: Fix parameter names
-
-2008-03-21 Sebastien Pouliot <sebastien@ximian.com>
-
- * EqualityComparer.cs: Add null checks in GetHashCode. Fix bug
- #372892
-
-2007-11-05 Sebastien Pouliot <sebastien@ximian.com>
-
- * Dictionary.cs: Ensure that the non-generic CopyTo works on Array.
- Fix #322783
-
-2007-10-31 Miguel de Icaza <miguel@novell.com>
-
- * Dictionary.cs: Do not increment curTableItem when we return
- false. Was not necessary, just a defensive move.
-
-2007-10-10 Juraj Skripsky <js@hotfeet.ch>
-
- * Dictionary.cs (Enumerator.MoveNext): Handle the case where we
- had already reached the end. Fixes bug #332534.
-
-2007-08-20 Jb Evain <jbevain@novell.com>
-
- * List.cs (AddCollection): return early if the collection
- to be added is empty.
-
-2007-08-08 Atsushi Enomoto <atsushi@ximian.com>
-
- * Dictionary.cs : [Comvisible(true)]->[ComVisible(false)].
-
-2007-06-23 Marek Safar <marek.safar@gmail.com>
-
- * List.cs: Make CheckMatch static.
-
-2007-06-20 Juraj Skripsky <js@hotfeet.ch>
-
- * Dictionary.cs: Optimize and add implementation notes. Use a "mini-heap"
- to store the linked lists instead of the regular heap. Split arrays of
- structs into separate arrays to make the GC's life simpler (see bug 81879
- for details). Make class serialization compatible with MS.NET.
-
- * EqualityComparer.cs: Rename IEquatableOfTEqualityComparer<T> to
- GenericEqualityComparer<T> to fix binary serialization compatibility
- with MS.
-
-2006-04-16 Jonathan Chambers <joncham@gmail.com>
-
- * List.cs: Clear entry in RemoveAt after removing item.
- Fixes bug #81387.
-
-2007-03-27 Alan McGovern <alan.mcgovern@gmail.com>
-
- * List.cs: Optimized several methods to increase performance
-
-2007-03-21 Juraj Skripsky <js@hotfeet.ch>
-
- * List.cs (FindAllStackBits): Small optimization to the new code.
- Built resulting List<T> directly as an array, wrap it in a List<T>
- afterwards. Stop the filling of the result array as soon as all
- matching items have been processed.
-
-2007-03-20 Juan Cristóbal Olivares <juancri@gmail.com>
-
- * List.cs (FindAll): Optimize FindAll using a bitmask to determine
- the number of positive matches, this increases the performance in
- all cases below 10,000,000 elements extensively:
-
- 100 elements:
- old method: 00:00:00.0126610 (26x)
- stackalloc bit method: 00:00:00.0004750 (1x)
- array bit method: 00:00:00.0010700 (2x)
- heap bit method: 00:00:00.0038830 (8x)
-
- 1,000 elements:
- old method: 00:00:00.0139250 (24x)
- stackalloc bit method: 00:00:00.0005670 (1x)
- array bit method: 00:00:00.0010890 (2x)
- heap bit method: 00:00:00.0034920 (6x)
-
- 10,000 elements:
- old method: 00:00:00.0136110 (12x)
- stackalloc bit method: 00:00:00.0011240 (1x)
- array bit method: 00:00:00.0016450 (1.4x)
- heap bit method: 00:00:00.0043110 (3x)
-
- 50,000 elements:
- old method: 00:00:00.0175970 (3x)
- stackalloc bit method: 00:00:00.0085630 (1.5x)
- array bit method: 00:00:00.0055010 (1x)
- heap bit method: 00:00:00.0099590 (1.8x)
-
- 100,000 elements:
- old method: 00:00:00.0210330 (2x)
- array bit method: 00:00:00.0100430 (1x)
- heap bit method: 00:00:00.0154150 (1.5x)
-
- 1,000,000 elements:
- old method: 00:00:00.1243730 (1.2x)
- array bit method: 00:00:00.0973110 (1x)
- heap bit method: 00:00:00.1285650 (1.3x)
-
- 10,000,000 elements:
- old method: 00:00:00.9252570 (1x)
- array bit method: 00:00:00.9632300 ( 1.05x)
- heap bit method: 00:00:01.1098490 (1.20x)
-
-2007-03-08 David Mitchell <dmitchell@logos.com>
-
- * List.cs: Fix the case where List.set_Item(int index) throws
- inappropriate exception when index is equal to List.Count
-
- List.IndexOf(object item) and IList.Contains(object item) throw
- exceptions when given invalid types.
-
- IList.Add(object item) throws InvalidCastException when item is
- not of the correct type.
-
-2007-03-08 Gert Driesen <drieseng@users.sourceforge.net>
-
- * Comparer.cs: Renamed IComparableOfTComparer<T> to GenericComparer<T>
- to fix binary serialization compatibility with MS.
-
-2007-03-05 David Mitchell <dmitchell@logos.com>
-
- * Dictionary.cs: An instance of Dictionary<TKey,TValue> is
- supposed to throw a KeyNotFoundException when
- the user attempts to retrieve the value associated with a key that
- is not in the dictionary.
-
- On the other hand, an instance of IDictionary is supposed to
- return null in similar circumstances.
-
-2007-03-05 David Mitchell <dmitchell@logos.com>
-
- * List.cs: Fix InsertRange bug (80930).
-
-2006-09-15 Gert Driesen <drieseng@users.sourceforge.net>
-
- * List.cs: Fixed binary serialization compatibility with MS.NET.
- Increment version whenever _items is modified; this fixes version
- checks in Enumerator.
-
-2006-09-06 Zoltan Varga <vargaz@gmail.com>
-
- * Dictionary.cs: Speed up get_Item/set_Item/GetPrev () a bit. Increase capacity
- specified by the user so 'capacity' elements can really be added without resizing.
-
-2006-07-12 Zoltan Varga <vargaz@gmail.com>
-
- * Dictionary.cs: Swap order of parameters to cmp.Equals () to improve
- compatibility with MS.NET and strange Equals () implementations.
-
-2006-05-17 Kazuki Oikawa <kazuki@panicode.com>
-
- * List.cs : implemented Sort(Comparison <T>).
-
-2006-05-08 Atsushi Enomoto <atsushi@ximian.com>
-
- * List.cs : use proper comparer in Contains(), IndexOf() and
- LastIndexOf(). Patch by Kazuki Oikawa. Fixed bug #77277.
-
-2006-03-16 Ankit Jain <jankit@novell.com>
-
- * List.cs (CheckIndex): Check for -ve indices and allow index == size.
- (Insert): Use CheckIndex.
-
-2006-03-12 Zoltan Varga <vargaz@gmail.com>
-
- * List.cs: Applied patch from <kazuki@panicode.com>. Fixes #77504.
-
-2006-02-10 Martin Baulig <martin@ximian.com>
-
- * Comparer.cs
- (IComparableOfTComparer): `T' must implement `IComparable<T>' and
- not `IComparable'.
-
-Tue Jan 24 18:22:54 CET 2006 Paolo Molaro <lupus@ximian.com>
-
- * Dictionary.cs: avoid long reminder operations.
-
-2006-01-23 Raja R Harinath <rharinath@novell.com>
-
- Speed up remove. Use 'dict[k]=v' as a self-tuning hint.
- * Dictionary.cs (GetSlot): Move data-structure traversal to ...
- (GetPrev): ... this. Returns the slot prior to the place we're
- looking for, or null if that place is the head of the chain.
- (Remove): Use it.
- (this.set): Use it. Implement move-to-front on set.
-
- * Dictionary.cs (ToTKey, ToTValue): New helpers to convert from
- type 'object'.
- (IDictionary.this, IDictionary.Add): Use them.
- (IDictionary.Contains, IDictionary.Remove): If the types don't
- match, do nothing.
-
-2006-01-19 Raja R Harinath <rharinath@novell.com>
-
- Fix to pass new nunit tests.
- * Dictionary.cs (ShimEnumerator): New class. Implement the
- requirement that ((IDictionary) foo).GetEnumerator ().Current has
- type DictionaryEntry.
- (IDictionary.GetEnumerator): Use ShimEnumerator.
- (Enumerator.Current): Now has type KeyValuePair<TKey, TValue>.
- (Enumerator.MoveNext): Use VerifyState.
- (Enumerator.VerifyState): Move validation of 'current' field to ...
- (Enumerator.CurrentSlot): ... this.
- (Enumerator.Current, Enumerator.IDictionaryEnumerator.Entry):
- Use CurrentSlot.
- (CopyTo, ICollection.CopyTo): Use subtle reasoning to replace a
- '>=' with a '>'. Don't throw an ArgumentException when
- index==array.Length && Count==0.
- (KeyCollection.CopyTo, ValueCollection.CopyTo): Likewise, and thus
- obviate the need to check (dictionary.Count == 0).
-
-2005-12-20 Sebastien Pouliot <sebastien@ximian.com>
-
- * List.cs: Applied Atsushi's patch for Sort (bug 76361) now that the
- generic versions of Array.Sort are implemented.
-
-2005-12-19 Sebastien Pouliot <sebastien@ximian.com>
-
- * Dictionary.cs: Added [Serializable] attribute to both inner
- Enumerator struct in Key and Value inner collection classes.
- * EqualityComparer.cs: Added missing IEqualityComparer interface.
- * List.cs: Added [Serializable] attribute to both inner Enumerator
- struct.
-
-2005-12-19 Sebastien Pouliot <sebastien@ximian.com>
-
- * Dictionary.cs: Fixed ICollection.CopyTo to use DictionaryEntry. Fixed
- Key and Value CopyTo not to throw exception if the dictionary is empty
- (fix bug #77019).
- * List.cs: Fix exception reporting to match MS behaviour (2.0 final).
-
-2005-11-19 Zoltan Varga <vargaz@gmail.com>
-
- * KeyNotFoundException.cs: Add default message.
-
-2005-09-18 Miguel de Icaza <miguel@novell.com>
-
- * Dictionary.cs: Change style for internal fields.
-
- If the capacity is zero, set the capacity to our default size as 0
- is an allowed parameter in .NET
-
-2005-08-10 Kamil Skalski <nazgul@nemerle.org>
-
- * KeyValuePair.cs, Dictionary.cs: Change Key and Value to properties to match
- .NET 2.0 July CTP. Update its use in Dictionary, since now we
- cannot write to them.
-
-2005-07-10 Kamil Skalski <nazgul@nemerle.org>
-
- * Comparer.cs, EqualityComparer.cs: Use MakeGenericType instead of BindGenericParameters.
-
-
-2005-06-27 Raja R Harinath <rharinath@novell.com>
-
- Introduce some thread-safety by removing the modify-on-read
- move-to-front heuristic.
- * Dictionary.cs (_enumeratorGeneration, _enumerators): Remove.
- (Count): Add internal property set. Invalidate enumerators when
- Count is changed. Change all references of _usedSlots to Count.
- (this): Invalidate enumerators when the value of some slot is
- changed, even if the layout of the data-structure isn't modified.
- (DoHash): Remove null-key check. All codepaths leading to this
- function already have the check.
- (GetSlot): Remove move-to-front heuristic.
- (Remove): Update.
-
-2005-06-24 Martin Baulig <martin@ximian.com>
-
- * IDictionary.cs: Use the same type parameter names than on MS.
-
- * IDictionary.cs, Dictionary.cs: We don't need the `CLSCompliant'
- attribute here.
-
-2005-06-23 Martin Baulig <martin@ximian.com>
-
- * *.cs: Removed the `[ComVisible(false)]' attributes everywhere.
-
-2005-06-22 Raja R Harinath <rharinath@novell.com>
-
- * Dictionary.cs (_generation, _enumeratorGeneration, _enumerators):
- New fields to implement fail-fast semantics. All code that
- modifies the table increment _generation.
- (GetSlot): Use _hcp to compare keys. Return the slot containing
- the key, rather than the index. Avoid move-to-front heuristic
- when there's an enumerator coursing through the table.
- (this, Add, TryGetValue, ContainsKey, Remove): Update to change.
- (Enumerator.Enumerator): Save the generation of the dictionary.
- (Enumerator.Dispose): Inform dictionary that the enumerator is no more.
- (Enumerator.MoveNext, Enumerator.VerifyState): Fail if the
- dictionary has been modified.
-
-2005-06-20 David waite <mass@akuma.org>
-
- * List.cs : substantial changes and optimizations
- (AddCollection, AddEnumerable): new internal specializations of AddRange
- (AsReadOnly): returns specific IList<T> to match ms.net 2.0b2 api.
- (Clear): reset size to zero on clear
- (ConvertAll): catch null converter, use Add to prevent OutOfBounds
- exception
- (FindAll, FindIndex, FindLast, FindLastIndex, RemoveAll, TrueForAll):
- check for null match
- (FindLastIndex): correct index parameters based on ms.net 2005b2 behavior
- (ForEach): catch null action
- (CheckIndex): new internal function similar to CheckRange for functions
- which only provide a starting index
- (InsertCollection, InsertEnumerable): new internal specializations of
- InsertRange
- (ReadOnlyList): removed, ReadOnlyCollection in
- System.Collections.ObjectModel is used instead now
-
-2005-06-16 David Waite <mass@akuma.org>
-
- * Dictionary.cs (EnumerationMode): Remove.
- (Enumerator): Remove return type flag - legacy return is expected to
- always return a DictionaryEntry
- (Enumerator): Make constructor internal, it is not public on ms.net
- beta 2
- (VerifyState): Added method to check state preconditions and throw
- appropriate exceptions.
- (KeyCollection,ValueCollection): Mark sealed to match ms.net beta 2
- (KeyCollection.Enumerator._hostEnumerator): make exact struct type,
- rather than boxing and using by interface
- (KeyCollection.Enumerator.Dispose): Call _hostEnumerator.Dispose.
- (ValueCollection.Enumerator._hostEnumerator): make exact struct type,
- rather than boxing and using by interface
- (ValueCollection.Enumerator.Dispose): Call _hostEnumerator.Dispose.
- * EqualityComparer.cs (DefaultComparer, IEquatableOfTEqualityComparer):
- Mark as serializable.
-
-2005-06-16 Raja R Harinath <rharinath@novell.com>
-
- * Dictionary.cs (GetKeys, GetValues): Remove.
- (SetThreshold): New function to calculate the resize threshold.
- (CopyTo): Don't use foreach syntax.
- (ContainsValue): Likewise. Use default equality comparer of the
- value type.
- (GetObjectData): Use CopyTo to copy into temporary array. Don't
- save redundant _usedSlots and _threshold.
- (OnDeserialization): Rewrite.
- (ICollection<>.CopyTo): Forward to CopyTo.
- (Enumerator._nextIndex): Rename to from _index.
- (Enumerator._next, Enumerator.FixNext): Remove.
- (Enumerator.Current): Rewrite to avoid need for _next.
- (Enumerator.IEnumerator.Reset): Update.
- (KeyCollection): Is also IEnumerable<TKey> and IEnumerable.
- Update methods to conform to standard.
- (KeyCollection.GetEnumerator): Restore. Return the correct type.
- (KeyCollection.Enumerator): Rename from KeyEnumerator. Simple
- wrapper that forwards to Dictionary<,>.Enumerator.
- (ValueCollection): Likewise.
-
-2005-06-12 David Waite <dwaite@gmail.com>
-
- * IKeyComparer.cs: removed
- * KeyValuePair.cs: add same-style ToString as ms.net Beta2 impl,
- make Serializable, use correct field names.
- * Dictionary.cs: Miscelaneus clean-ups, added serialization
- support, use Hashtable prime functions
-
-2005-06-12 Ben Maurer <bmaurer@ximian.com>
-
- * Comparer.cs, EqualityComparer.cs: Important performance hack:
- make sure that we don't box stuff and do reflection on every
- comparison. We use reflection at cctor time rather than on every
- request.
-
-2005-06-09 Raja R Harinath <rharinath@novell.com>
-
- Simplify Enumerator.MoveNext to make it "obviously correct", rather
- than require subtle reasoning about the state of various variables.
- * Dictionary.cs (Enumerator._isValid): Remove. Replace all uses
- with "_current == null".
- (Enumerator._validNodeVisited): Remove.
- (Enumerator._next): New. Holds the the next position.
- (Enumerator.FixNest): New helper function that ensures that _next
- has the right value.
- (Enumerator.MoveNext): Simplify. Now, copies _next to _current
- and advances _next if possible.
-
-2005-06-08 Martin Baulig <martin@ximian.com>
-
- * Dictionary.cs (Dictionary.KeyEnumerator): Removed the public
- GetEnumerator() function since it's returning the wrong type.
- (Dictionary.ValueEnumerator): Likewise. Fix #75073.
-
-2005-06-08 Ankit Jain <ankit@corewars.org>
-
- * Dictionary.cs (Dictionary<TKey, TValue>.MoveNext): Allow traversal of chain in last slot
- of the table. Fixes #75168.
-
-2005-06-04 Ben Maurer <bmaurer@ximian.com>
-
- * *.cs: 2.0 api fixups
-
-2005-05-26 Miguel de Icaza <miguel@novell.com>
-
- * Dictionary.cs: Remove the `Hash' name from the Dictionary
- internal classes, make them public.
-
-2005-05-26 Zoltan Varga <vargaz@freemail.hu>
-
- * Dictionary.cs: Fix a warning.
-
- * IDictionary.cs: Add missing TryGetValue method.
-
-2005-05-19 Geoff Norton <gnorton@customerdna.com>
-
- * List.cs (Insert): Resize the array before the shift if needed
-
-2005-05-18 Miguel de Icaza <miguel@novell.com>
-
- * List.cs (GetRange): Implement.
-
- Do not do lazy loading of data. Not worth adding an
- extra check, and not worth the bugs.
-
- This decision wont be discussed until: a) a full List regression
- test suite exists and b) performance benchmarks are created. (b)
- depends on (a) or the argument wont even be heard.
-
-2005-05-13 Atsushi Enomoto <atsushi@ximian.com>
-
- * Queue.cs, Stack.cs: moved to System.dll
-
-2005-05-06 Martin Baulig <martin@ximian.com>
-
- * *.cs: Add CLSCompliant(true) where missing.
-
-2005-05-06 Zoltan Varga <vargaz@freemail.hu>
-
- * *.cs: Remove CLSCompliant(false) attributes.
-
-2005-05-05 Zoltan Varga <vargaz@freemail.hu>
-
- * List.cs: Applied patch from Mart Roosmaa (roosmaa@gmail.com).
- Fix Insert method. Fixes #74824.
-
-2005-04-29 Martin Baulig <martin@ximian.com>
-
- Reflect latest spec changes.
-
- * IEnumerable.cs (IEnumerable<T>): Implement IEnumerable.
- * IEnumerator.cs (IEnumerator<T>): Implement IEnumerator.
-
-2005-04-29 Raja R Harinath <rharinath@novell.com>
-
- Remove FIXME.
- * Dictionary.cs (Slot<K,V>): Move to ...
- (Dictionary<K,V>.Slot): ... here.
-
-2005-04-28 Martin Baulig <martin@ximian.com>
-
- * Dictionary.cs, Queue.cs, Stack.cs, List.cs, Comparer.cs: Don't
- duplicate type parameters in the nested classes.
-
-2005-04-20 Zoltan Varga <vargaz@freemail.hu>
-
- * List.cs: Fix ToArray () method. Fixes #74675.
-
-2005-04-04 Raja R Harinath <rharinath@novell.com>
-
- * Dictionary.cs: Update to draft of Feb 27. Add some argument checks.
- (GetSlot): Don't throw KeyNotFoundException. Unify all list
- traversals in here. Move found key to head of chain, and return
- the index of the chain suitable for/containing the key.
- (Item, Add, Remove): Simplify, and remove FIXMEs.
- (Resize): Reuse linked list nodes from old table.
- (Dictionary.CopyTo, HashKeyCollection.CopyTo, HashValueCollection.CopyTo):
- Add some argument checks.
-
-2005-04-02 Ben Maurer <bmaurer@ximian.com>
-
- * Dictionary.cs: Real impl.
-
-2005-02-21 Martin Baulig <martin@ximian.com>
-
- * IComparer.cs: Reverted the last change here, Equals() and
- GetHashCode() have been removed a long time ago.
-
-2005-02-21 Kazuki Oikawa <kazuki@panicode.com>
-
- * IComparer.cs, IDictionary.cs: Corrected the wrong declaration.
-
-2005-02-11 Carlos Alberto Cortez <calberto.cortez@gmail.com>
-
- * List.cs: Added internal ReadOnlyCollection class,
- which is a wrapper for a read only IList<T> version of the List<T>.
- Used in AsReadOnly () method.
-
-2005-02-07 Ben Maurer <bmaurer@ximian.com>
-
- * List.cs (CheckRange): Comparison error. Duh!
- (Shift): really deal with neg. delta. Also, adjust the `size'.
-
- Based on a patch from Marc Denty (marc.denty@libertysurf.fr).
-
- Fixes #72258.
-
-2005-01-29 Ben Maurer <bmaurer@ximian.com>
-
- * Queue.cs: `duh' bugs.
-
-2004-12-27 Ben Maurer <bmaurer@ximian.com>
-
- * Stack.cs: Stupid bug fixes.
-
- * List.cs: My new (mostly untested ;-) impl of List
- <T>. Implements most of the API.
-
-2004-12-26 Ben Maurer <bmaurer@ximian.com>
-
- * Queue.cs: New, non-linked-list based impl.
-
-2004-11-29 Ben Maurer <bmaurer@ximian.com>
-
- * Comparer.cs: Update this class.
-
-2004-11-25 Carlos Alberto Cortez <calberto.cortez@gmail.com>
-
- * List.cs: Enumerator changed to behave like the MS impl.
-
-2004-11-25 Ben Maurer <bmaurer@ximian.com>
-
- * Stack.cs: New, list based impl. Waiting for some gmcs fixes.
-
-2004-11-10 Martin Baulig <martin@ximian.com>
-
- * IDictionary.cs (IDictionary): `IsReadOnly' and `Clear' are
- inherited from ICollection.
-
-2004-09-20 Gert Driesen <drieseng@users.sourceforge.net>
-
- * ReadOnlyCollection.cs: Moved to System assembly
- * Collection.cs: Moved to System assembly
-
-2004-09-07 Carlos Alberto Cortez <carlos@unixmexico.org>
-
- * ReadOnlyCollection.cs: New file and changes to
- Collection.cs tu support it.
-
-2004-09-05 Marek Safar <marek.safar@seznam.cz>
-
- * Dictionary.cs: Added new file (no implementation).
-
-2004-09-03 Carlos Alberto Cortez <carlos@unixmexico.org>
-
- * Collection.cs: Small improvements related to
- style, resizing, and type checking.
-
-2004-09-01 Carlos Alberto Cortez <carlos@unixmexico.org>
-
- * Collection.cs: New file.
-
-2004-08-04 Martin Baulig <martin@ximian.com>
-
- * List.cs (List<T>.Enumerator): Made this a struct.
- (List<T>.GetEnumerator): The public method now returns the
- `Enumerator' struct.
-
-2004-08-02 Martin Baulig <martin@ximian.com>
-
- Started to do some API review.
-
- * ICollection.cs (ICollection<T>): Added IsReadOnly, Add, Clear,
- Contains and Remove.
-
- * IList.cs (IList<T>): Removed Add, Clear, Constains, Remove,
- IsReadOnly and IsFixedSize.
-
-2004-08-02 Martin Baulig <martin@ximian.com>
-
- * IList.cs (IList.Add): Changed return type to void.
-
- * List.cs (List.Add): Likewise.
-
-2004-07-16 Martin Baulig <martin@ximian.com>
-
- * IComparable.cs: Removed, it's in System.
-
-2004-07-12 Duncan Mak <duncan@ximian.com>
-
- * KeyNotFoundException.cs: Added.
-
-2004-06-18 Ben Maurer <bmaurer@ximian.com>
-
- * Comparer.cs: v2 impl. Some workarounds for gmcs are enabled.
-
-2004-05-26 Sebastien Pouliot <sebastien@ximian.com>
-
- * Queue.cs: Fixed possible integer overflow in CopyTo methods.
- * Stack.cs: Fixed possible integer overflow in CopyTo methods.
-
-2004-03-13 Martin Baulig <martin@ximian.com>
-
- * Stack.cs, Queue.cs, List.cs: Implement the non-generic interfaces.
-
-2004-03-11 Martin Baulig <martin@ximian.com>
-
- * List.cs: New file.
-
-2004-03-11 Martin Baulig <martin@ximian.com>
-
- * Stack.cs, Queue.cs: Just use `Node' for the nested class, not
- `Node<T>' (which would create another type parameter `T'
- overriding `T' from the outer class).
-
-2004-02-23 Martin Baulig <martin@ximian.com>
-
- * Stack.cs, Queue.cs: New files. Hmm, looks like I forgot to add
- them to CVS; they're already on my hard disk since December or so.
-
-2003-12-08 Martin Baulig <martin@ximian.com>
-
- * *.cs: require GENERICS.
-
-2003-11-08 Ben Maurer <bmaurer@users.sourceforge.net>
-
- * *.cs: require NET_2_0 and GENERICS
-
-2003-11-07 Ben Maurer <bmaurer@users.sourceforge.net>
-
- * IComparable.cs, IComparer.cs, IDictionary.cs, IKeyComparer.cs, KeyValuePair.cs
- Added.
-
-2003-11-06 Martin Baulig <martin@ximian.com>
-
- * ICollection.cs, IList.cs, IEnumerator.cs, IEnumerable.cs:
- Started to implement the System.Collections.Generic classes.
-
+++ /dev/null
-//
-// CollectionDebuggerView.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Diagnostics;
-
-namespace System.Collections.Generic
-{
- //
- // Custom debugger type proxy to display collections as arrays
- //
- internal sealed class CollectionDebuggerView<T>
- {
- readonly ICollection<T> c;
-
- public CollectionDebuggerView (ICollection<T> col)
- {
- this.c = col;
- }
-
- [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
- public T[] Items {
- get {
- var o = new T [c.Count];
- c.CopyTo (o, 0);
- return o;
- }
- }
- }
-
- internal sealed class CollectionDebuggerView<T, U>
- {
- readonly ICollection<KeyValuePair<T, U>> c;
-
- public CollectionDebuggerView (ICollection<KeyValuePair<T, U>> col)
- {
- this.c = col;
- }
-
- [DebuggerBrowsable (DebuggerBrowsableState.RootHidden)]
- public KeyValuePair<T, U>[] Items {
- get {
- var o = new KeyValuePair<T, U> [c.Count];
- c.CopyTo (o, 0);
- return o;
- }
- }
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.Dictionary
-//
-// Authors:
-// Sureshkumar T (tsureshkumar@novell.com)
-// Marek Safar (marek.safar@gmail.com)
-// Ankit Jain (radical@corewars.org)
-// David Waite (mass@akuma.org)
-// Juraj Skripsky (js@hotfeet.ch)
-//
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 David Waite
-// Copyright (C) 2007 HotFeet GmbH (http://www.hotfeet.ch)
-// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-
-namespace System.Collections.Generic {
-
- /*
- * Declare this outside the main class so it doesn't have to be inflated for each
- * instantiation of Dictionary.
- */
- internal struct Link {
- public int HashCode;
- public int Next;
- }
-
- [ComVisible(false)]
- [Serializable]
- [DebuggerDisplay ("Count={Count}")]
- [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
- public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, ISerializable, IDeserializationCallback
- , IReadOnlyDictionary<TKey, TValue>
- {
- // The implementation of this class uses a hash table and linked lists
- // (see: http://msdn2.microsoft.com/en-us/library/ms379571(VS.80).aspx).
- //
- // We use a kind of "mini-heap" instead of reference-based linked lists:
- // "keySlots" and "valueSlots" is the heap itself, it stores the data
- // "linkSlots" contains information about how the slots in the heap
- // are connected into linked lists
- // In addition, the HashCode field can be used to check if the
- // corresponding key and value are present (HashCode has the
- // HASH_FLAG bit set in this case), so, to iterate over all the
- // items in the dictionary, simply iterate the linkSlots array
- // and check for the HASH_FLAG bit in the HashCode field.
- // For this reason, each time a hashcode is calculated, it needs
- // to be ORed with HASH_FLAG before comparing it with the save hashcode.
- // "touchedSlots" and "emptySlot" manage the free space in the heap
-
- const int INITIAL_SIZE = 4;
- const float DEFAULT_LOAD_FACTOR = (90f / 100);
- const int NO_SLOT = -1;
- const int HASH_FLAG = -2147483648;
-
- // The hash table contains indices into the linkSlots array
- int [] table;
-
- // All (key,value) pairs are chained into linked lists. The connection
- // information is stored in "linkSlots" along with the key's hash code
- // (for performance reasons).
- // TODO: get rid of the hash code in Link (this depends on a few
- // JIT-compiler optimizations)
- // Every link in "linkSlots" corresponds to the (key,value) pair
- // in "keySlots"/"valueSlots" with the same index.
- Link [] linkSlots;
- TKey [] keySlots;
- TValue [] valueSlots;
-
- //Leave those 2 fields here to improve heap layout.
- IEqualityComparer<TKey> hcp;
- SerializationInfo serialization_info;
-
- // The number of slots in "linkSlots" and "keySlots"/"valueSlots" that
- // are in use (i.e. filled with data) or have been used and marked as
- // "empty" later on.
- int touchedSlots;
-
- // The index of the first slot in the "empty slots chain".
- // "Remove()" prepends the cleared slots to the empty chain.
- // "Add()" fills the first slot in the empty slots chain with the
- // added item (or increases "touchedSlots" if the chain itself is empty).
- int emptySlot;
-
- // The number of (key,value) pairs in this dictionary.
- int count;
-
- // The number of (key,value) pairs the dictionary can hold without
- // resizing the hash table and the slots arrays.
- int threshold;
-
- // The number of changes made to this dictionary. Used by enumerators
- // to detect changes and invalidate themselves.
- int generation;
-
- public int Count {
- get { return count; }
- }
-
- public TValue this [TKey key] {
- get {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int cur = table [(hashCode & int.MaxValue) % table.Length] - 1;
-
- // walk linked list until right slot is found or end is reached
- while (cur != NO_SLOT) {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key))
- return valueSlots [cur];
- cur = linkSlots [cur].Next;
- }
- throw new KeyNotFoundException ();
- }
-
- set {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int index = (hashCode & int.MaxValue) % table.Length;
- int cur = table [index] - 1;
-
- // walk linked list until right slot (and its predecessor) is
- // found or end is reached
- int prev = NO_SLOT;
- if (cur != NO_SLOT) {
- do {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key))
- break;
- prev = cur;
- cur = linkSlots [cur].Next;
- } while (cur != NO_SLOT);
- }
-
- // is there no slot for the given key yet?
- if (cur == NO_SLOT) {
- // there is no existing slot for the given key,
- // allocate one and prepend it to its corresponding linked
- // list
-
- if (++count > threshold) {
- Resize ();
- index = (hashCode & int.MaxValue) % table.Length;
- }
-
- // find an empty slot
- cur = emptySlot;
- if (cur == NO_SLOT)
- cur = touchedSlots++;
- else
- emptySlot = linkSlots [cur].Next;
-
- // prepend the added item to its linked list,
- // update the hash table
- linkSlots [cur].Next = table [index] - 1;
- table [index] = cur + 1;
-
- // store the new item and its hash code
- linkSlots [cur].HashCode = hashCode;
- keySlots [cur] = key;
- } else {
- // we already have a slot for the given key,
- // update the existing slot
-
- // if the slot is not at the front of its linked list,
- // we move it there
- if (prev != NO_SLOT) {
- linkSlots [prev].Next = linkSlots [cur].Next;
- linkSlots [cur].Next = table [index] - 1;
- table [index] = cur + 1;
- }
- }
-
- // store the item's data itself
- valueSlots [cur] = value;
-
- generation++;
- }
- }
-
- public Dictionary ()
- {
- Init (INITIAL_SIZE, null);
- }
-
- public Dictionary (IEqualityComparer<TKey> comparer)
- {
- Init (INITIAL_SIZE, comparer);
- }
-
- public Dictionary (IDictionary<TKey, TValue> dictionary)
- : this (dictionary, null)
- {
- }
-
- public Dictionary (int capacity)
- : this (capacity, null)
- {
- }
-
- public Dictionary (IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)
- {
- if (dictionary == null)
- throw new ArgumentNullException ("dictionary");
-
- Init (dictionary.Count, comparer);
- foreach (KeyValuePair<TKey, TValue> entry in dictionary)
- this.Add (entry.Key, entry.Value);
- }
-
- public Dictionary (int capacity, IEqualityComparer<TKey> comparer)
- {
- if (capacity < 0)
- throw new ArgumentOutOfRangeException ("capacity");
-
- Init (capacity, comparer);
- }
-
- protected Dictionary (SerializationInfo info, StreamingContext context)
- {
- serialization_info = info;
- }
-
- void Init (int capacity, IEqualityComparer<TKey> hcp)
- {
- this.hcp = hcp ?? EqualityComparer<TKey>.Default;
-
- capacity = Math.Max (1, (int)(capacity / DEFAULT_LOAD_FACTOR));
- InitArrays (capacity);
- }
-
- void InitArrays (int size)
- {
- table = new int [size];
-
- linkSlots = new Link [size];
- emptySlot = NO_SLOT;
-
- keySlots = new TKey [size];
- valueSlots = new TValue [size];
- touchedSlots = 0;
-
- threshold = (int)(table.Length * DEFAULT_LOAD_FACTOR);
- if (threshold == 0 && table.Length > 0)
- threshold = 1;
- }
-
- void CopyToCheck (Array array, int index)
- {
- if (array == null)
- throw new ArgumentNullException ("array");
- if (index < 0)
- throw new ArgumentOutOfRangeException ("index");
- // we want no exception for index==array.Length && Count == 0
- if (index > array.Length)
- throw new ArgumentException ("index larger than largest valid index of array");
- if (array.Length - index < Count)
- throw new ArgumentException ("Destination array cannot hold the requested elements!");
- }
-
- void CopyKeys (TKey[] array, int index)
- {
- for (int i = 0; i < touchedSlots; i++) {
- if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
- array [index++] = keySlots [i];
- }
- }
-
- void CopyValues (TValue[] array, int index)
- {
- for (int i = 0; i < touchedSlots; i++) {
- if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
- array [index++] = valueSlots [i];
- }
- }
-
- delegate TRet Transform<TRet> (TKey key, TValue value);
-
-
- static KeyValuePair<TKey, TValue> make_pair (TKey key, TValue value)
- {
- return new KeyValuePair<TKey, TValue> (key, value);
- }
-
- static TKey pick_key (TKey key, TValue value)
- {
- return key;
- }
-
- static TValue pick_value (TKey key, TValue value)
- {
- return value;
- }
-
- void CopyTo (KeyValuePair<TKey, TValue> [] array, int index)
- {
- CopyToCheck (array, index);
- for (int i = 0; i < touchedSlots; i++) {
- if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
- array [index++] = new KeyValuePair<TKey, TValue> (keySlots [i], valueSlots [i]);
- }
- }
-
- void Do_ICollectionCopyTo<TRet> (Array array, int index, Transform<TRet> transform)
- {
- Type src = typeof (TRet);
- Type tgt = array.GetType ().GetElementType ();
-
- try {
- if ((src.IsPrimitive || tgt.IsPrimitive) && !tgt.IsAssignableFrom (src))
- throw new Exception (); // we don't care. it'll get transformed to an ArgumentException below
-
-#if BOOTSTRAP_BASIC
- // BOOTSTRAP: gmcs 2.4.x seems to have trouble compiling the alternative
- throw new Exception ();
-#else
- object[] dest = (object[])array;
- for (int i = 0; i < touchedSlots; i++) {
- if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
- dest [index++] = transform (keySlots [i], valueSlots [i]);
- }
-#endif
-
- } catch (Exception e) {
- throw new ArgumentException ("Cannot copy source collection elements to destination array", "array", e);
- }
- }
-
- private void Resize ()
- {
- // From the SDK docs:
- // Hashtable is automatically increased
- // to the smallest prime number that is larger
- // than twice the current number of Hashtable buckets
- int newSize = HashPrimeNumbers.ToPrime ((table.Length << 1) | 1);
-
- // allocate new hash table and link slots array
- int [] newTable = new int [newSize];
- Link [] newLinkSlots = new Link [newSize];
-
- for (int i = 0; i < table.Length; i++) {
- int cur = table [i] - 1;
- while (cur != NO_SLOT) {
- int hashCode = newLinkSlots [cur].HashCode = hcp.GetHashCode(keySlots [cur]) | HASH_FLAG;
- int index = (hashCode & int.MaxValue) % newSize;
- newLinkSlots [cur].Next = newTable [index] - 1;
- newTable [index] = cur + 1;
- cur = linkSlots [cur].Next;
- }
- }
- table = newTable;
- linkSlots = newLinkSlots;
-
- // allocate new data slots, copy data
- TKey [] newKeySlots = new TKey [newSize];
- TValue [] newValueSlots = new TValue [newSize];
- Array.Copy (keySlots, 0, newKeySlots, 0, touchedSlots);
- Array.Copy (valueSlots, 0, newValueSlots, 0, touchedSlots);
- keySlots = newKeySlots;
- valueSlots = newValueSlots;
-
- threshold = (int)(newSize * DEFAULT_LOAD_FACTOR);
- }
-
- public void Add (TKey key, TValue value)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int index = (hashCode & int.MaxValue) % table.Length;
- int cur = table [index] - 1;
-
- // walk linked list until end is reached (throw an exception if a
- // existing slot is found having an equivalent key)
- while (cur != NO_SLOT) {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key))
- throw new ArgumentException ("An element with the same key already exists in the dictionary.");
- cur = linkSlots [cur].Next;
- }
-
- if (++count > threshold) {
- Resize ();
- index = (hashCode & int.MaxValue) % table.Length;
- }
-
- // find an empty slot
- cur = emptySlot;
- if (cur == NO_SLOT)
- cur = touchedSlots++;
- else
- emptySlot = linkSlots [cur].Next;
-
- // store the hash code of the added item,
- // prepend the added item to its linked list,
- // update the hash table
- linkSlots [cur].HashCode = hashCode;
- linkSlots [cur].Next = table [index] - 1;
- table [index] = cur + 1;
-
- // store item's data
- keySlots [cur] = key;
- valueSlots [cur] = value;
-
- generation++;
- }
-
- public IEqualityComparer<TKey> Comparer {
- get { return hcp; }
- }
-
- public void Clear ()
- {
- if (count == 0)
- return;
-
- count = 0;
- // clear the hash table
- Array.Clear (table, 0, table.Length);
- // clear arrays
- Array.Clear (keySlots, 0, keySlots.Length);
- Array.Clear (valueSlots, 0, valueSlots.Length);
- Array.Clear (linkSlots, 0, linkSlots.Length);
-
- // empty the "empty slots chain"
- emptySlot = NO_SLOT;
-
- touchedSlots = 0;
- generation++;
- }
-
- public bool ContainsKey (TKey key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int cur = table [(hashCode & int.MaxValue) % table.Length] - 1;
-
- // walk linked list until right slot is found or end is reached
- while (cur != NO_SLOT) {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key))
- return true;
- cur = linkSlots [cur].Next;
- }
-
- return false;
- }
-
- public bool ContainsValue (TValue value)
- {
- IEqualityComparer<TValue> cmp = EqualityComparer<TValue>.Default;
-
- for (int i = 0; i < table.Length; i++) {
- int cur = table [i] - 1;
- while (cur != NO_SLOT) {
- if (cmp.Equals (valueSlots [cur], value))
- return true;
- cur = linkSlots [cur].Next;
- }
- }
- return false;
- }
-
- [SecurityPermission (SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
- public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- if (info == null)
- throw new ArgumentNullException ("info");
-
- info.AddValue ("Version", generation);
- info.AddValue ("Comparer", hcp);
- // MS.NET expects either *no* KeyValuePairs field (when count = 0)
- // or a non-null KeyValuePairs field. We don't omit the field to
- // remain compatible with older monos, but we also doesn't serialize
- // it as null to make MS.NET happy.
- KeyValuePair<TKey, TValue> [] data = new KeyValuePair<TKey,TValue> [count];
- if (count > 0)
- CopyTo (data, 0);
- info.AddValue ("HashSize", table.Length);
- info.AddValue ("KeyValuePairs", data);
- }
-
- public virtual void OnDeserialization (object sender)
- {
- if (serialization_info == null)
- return;
-
- int hashSize = 0;
- KeyValuePair<TKey, TValue> [] data = null;
-
- // We must use the enumerator because MS.NET doesn't
- // serialize "KeyValuePairs" for count = 0.
- SerializationInfoEnumerator e = serialization_info.GetEnumerator ();
- while (e.MoveNext ()) {
- switch (e.Name) {
- case "Version":
- generation = (int) e.Value;
- break;
-
- case "Comparer":
- hcp = (IEqualityComparer<TKey>) e.Value;
- break;
-
- case "HashSize":
- hashSize = (int) e.Value;
- break;
-
- case "KeyValuePairs":
- data = (KeyValuePair<TKey, TValue> []) e.Value;
- break;
- }
- }
-
- if (hcp == null)
- hcp = EqualityComparer<TKey>.Default;
- if (hashSize < INITIAL_SIZE)
- hashSize = INITIAL_SIZE;
- InitArrays (hashSize);
- count = 0;
-
- if (data != null) {
- for (int i = 0; i < data.Length; ++i)
- Add (data [i].Key, data [i].Value);
- }
- generation++;
- serialization_info = null;
- }
-
- public bool Remove (TKey key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int index = (hashCode & int.MaxValue) % table.Length;
- int cur = table [index] - 1;
-
- // if there is no linked list, return false
- if (cur == NO_SLOT)
- return false;
-
- // walk linked list until right slot (and its predecessor) is
- // found or end is reached
- int prev = NO_SLOT;
- do {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key))
- break;
- prev = cur;
- cur = linkSlots [cur].Next;
- } while (cur != NO_SLOT);
-
- // if we reached the end of the chain, return false
- if (cur == NO_SLOT)
- return false;
-
- count--;
- // remove slot from linked list
- // is slot at beginning of linked list?
- if (prev == NO_SLOT)
- table [index] = linkSlots [cur].Next + 1;
- else
- linkSlots [prev].Next = linkSlots [cur].Next;
-
- // mark slot as empty and prepend it to "empty slots chain"
- linkSlots [cur].Next = emptySlot;
- emptySlot = cur;
-
- linkSlots [cur].HashCode = 0;
- // clear empty key and value slots
- keySlots [cur] = default (TKey);
- valueSlots [cur] = default (TValue);
-
- generation++;
- return true;
- }
-
- public bool TryGetValue (TKey key, out TValue value)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
-
- // get first item of linked list corresponding to given key
- int hashCode = hcp.GetHashCode (key) | HASH_FLAG;
- int cur = table [(hashCode & int.MaxValue) % table.Length] - 1;
-
- // walk linked list until right slot is found or end is reached
- while (cur != NO_SLOT) {
- // The ordering is important for compatibility with MS and strange
- // Object.Equals () implementations
- if (linkSlots [cur].HashCode == hashCode && hcp.Equals (keySlots [cur], key)) {
- value = valueSlots [cur];
- return true;
- }
- cur = linkSlots [cur].Next;
- }
-
- // we did not find the slot
- value = default (TValue);
- return false;
- }
-
- ICollection<TKey> IDictionary<TKey, TValue>.Keys {
- get { return Keys; }
- }
-
- ICollection<TValue> IDictionary<TKey, TValue>.Values {
- get { return Values; }
- }
-
- IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys {
- get { return Keys; }
- }
-
- IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values {
- get { return Values; }
- }
-
- public KeyCollection Keys {
- get { return new KeyCollection (this); }
- }
-
- public ValueCollection Values {
- get { return new ValueCollection (this); }
- }
-
- ICollection IDictionary.Keys {
- get { return Keys; }
- }
-
- ICollection IDictionary.Values {
- get { return Values; }
- }
-
- bool IDictionary.IsFixedSize {
- get { return false; }
- }
-
- bool IDictionary.IsReadOnly {
- get { return false; }
- }
-
- static TKey ToTKey (object key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- if (!(key is TKey))
- throw new ArgumentException ("not of type: " + typeof (TKey).ToString (), "key");
- return (TKey) key;
- }
-
- static TValue ToTValue (object value)
- {
- if (value == null && !typeof (TValue).IsValueType)
- return default (TValue);
- if (!(value is TValue))
- throw new ArgumentException ("not of type: " + typeof (TValue).ToString (), "value");
- return (TValue) value;
- }
-
- object IDictionary.this [object key] {
- get {
- TValue obj;
- if (key is TKey && TryGetValue ((TKey) key, out obj))
- return obj;
- return null;
- }
- set { this [ToTKey (key)] = ToTValue (value); }
- }
-
- void IDictionary.Add (object key, object value)
- {
- this.Add (ToTKey (key), ToTValue (value));
- }
-
- bool IDictionary.Contains (object key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- if (key is TKey)
- return ContainsKey ((TKey) key);
- return false;
- }
-
- void IDictionary.Remove (object key)
- {
- if (key == null)
- throw new ArgumentNullException ("key");
- if (key is TKey)
- Remove ((TKey) key);
- }
-
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return this; }
- }
-
- bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly {
- get { return false; }
- }
-
- void ICollection<KeyValuePair<TKey, TValue>>.Add (KeyValuePair<TKey, TValue> keyValuePair)
- {
- Add (keyValuePair.Key, keyValuePair.Value);
- }
-
- bool ICollection<KeyValuePair<TKey, TValue>>.Contains (KeyValuePair<TKey, TValue> keyValuePair)
- {
- return ContainsKeyValuePair (keyValuePair);
- }
-
- void ICollection<KeyValuePair<TKey, TValue>>.CopyTo (KeyValuePair<TKey, TValue> [] array, int index)
- {
- this.CopyTo (array, index);
- }
-
- bool ICollection<KeyValuePair<TKey, TValue>>.Remove (KeyValuePair<TKey, TValue> keyValuePair)
- {
- if (!ContainsKeyValuePair (keyValuePair))
- return false;
-
- return Remove (keyValuePair.Key);
- }
-
- bool ContainsKeyValuePair (KeyValuePair<TKey, TValue> pair)
- {
- TValue value;
- if (!TryGetValue (pair.Key, out value))
- return false;
-
- return EqualityComparer<TValue>.Default.Equals (pair.Value, value);
- }
-
- void ICollection.CopyTo (Array array, int index)
- {
- KeyValuePair<TKey, TValue> [] pairs = array as KeyValuePair<TKey, TValue> [];
- if (pairs != null) {
- this.CopyTo (pairs, index);
- return;
- }
-
- CopyToCheck (array, index);
- DictionaryEntry [] entries = array as DictionaryEntry [];
- if (entries != null) {
- for (int i = 0; i < touchedSlots; i++) {
- if ((linkSlots [i].HashCode & HASH_FLAG) != 0)
- entries [index++] = new DictionaryEntry (keySlots [i], valueSlots [i]);
- }
- return;
- }
-
- Do_ICollectionCopyTo<KeyValuePair<TKey, TValue>> (array, index, make_pair);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- IDictionaryEnumerator IDictionary.GetEnumerator ()
- {
- return new ShimEnumerator (this);
- }
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- [Serializable]
- private class ShimEnumerator : IDictionaryEnumerator, IEnumerator
- {
- Enumerator host_enumerator;
- public ShimEnumerator (Dictionary<TKey, TValue> host)
- {
- host_enumerator = host.GetEnumerator ();
- }
-
- public void Dispose ()
- {
- host_enumerator.Dispose ();
- }
-
- public bool MoveNext ()
- {
- return host_enumerator.MoveNext ();
- }
-
- public DictionaryEntry Entry {
- get { return ((IDictionaryEnumerator) host_enumerator).Entry; }
- }
-
- public object Key {
- get { return host_enumerator.Current.Key; }
- }
-
- public object Value {
- get { return host_enumerator.Current.Value; }
- }
-
- // This is the raison d' etre of this $%!@$%@^@ class.
- // We want: IDictionary.GetEnumerator ().Current is DictionaryEntry
- public object Current {
- get { return Entry; }
- }
-
- public void Reset ()
- {
- host_enumerator.Reset ();
- }
- }
-
- [Serializable]
- public struct Enumerator : IEnumerator<KeyValuePair<TKey,TValue>>,
- IDisposable, IDictionaryEnumerator, IEnumerator
- {
- Dictionary<TKey, TValue> dictionary;
- int next;
- int stamp;
-
- internal KeyValuePair<TKey, TValue> current;
-
- internal Enumerator (Dictionary<TKey, TValue> dictionary)
- : this ()
- {
- this.dictionary = dictionary;
- stamp = dictionary.generation;
- }
-
- public bool MoveNext ()
- {
- VerifyState ();
-
- if (next < 0)
- return false;
-
- while (next < dictionary.touchedSlots) {
- int cur = next++;
- if ((dictionary.linkSlots [cur].HashCode & HASH_FLAG) != 0) {
- current = new KeyValuePair <TKey, TValue> (
- dictionary.keySlots [cur],
- dictionary.valueSlots [cur]
- );
- return true;
- }
- }
-
- next = -1;
- return false;
- }
-
- // No error checking happens. Usually, Current is immediately preceded by a MoveNext(), so it's wasteful to check again
- public KeyValuePair<TKey, TValue> Current {
- get { return current; }
- }
-
- internal TKey CurrentKey {
- get {
- VerifyCurrent ();
- return current.Key;
- }
- }
-
- internal TValue CurrentValue {
- get {
- VerifyCurrent ();
- return current.Value;
- }
- }
-
- object IEnumerator.Current {
- get {
- VerifyCurrent ();
- return current;
- }
- }
-
- void IEnumerator.Reset ()
- {
- Reset ();
- }
-
- internal void Reset ()
- {
- VerifyState ();
- next = 0;
- }
-
- DictionaryEntry IDictionaryEnumerator.Entry {
- get {
- VerifyCurrent ();
- return new DictionaryEntry (current.Key, current.Value);
- }
- }
-
- object IDictionaryEnumerator.Key {
- get { return CurrentKey; }
- }
-
- object IDictionaryEnumerator.Value {
- get { return CurrentValue; }
- }
-
- void VerifyState ()
- {
- if (dictionary == null)
- throw new ObjectDisposedException (null);
- if (dictionary.generation != stamp)
- throw new InvalidOperationException ("out of sync");
- }
-
- void VerifyCurrent ()
- {
- VerifyState ();
- if (next <= 0)
- throw new InvalidOperationException ("Current is not valid");
- }
-
- public void Dispose ()
- {
- dictionary = null;
- }
- }
-
- // This collection is a read only collection
- [Serializable]
- [DebuggerDisplay ("Count={Count}")]
- [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
- public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, ICollection, IEnumerable {
- Dictionary<TKey, TValue> dictionary;
-
- public KeyCollection (Dictionary<TKey, TValue> dictionary)
- {
- if (dictionary == null)
- throw new ArgumentNullException ("dictionary");
- this.dictionary = dictionary;
- }
-
-
- public void CopyTo (TKey [] array, int index)
- {
- dictionary.CopyToCheck (array, index);
- dictionary.CopyKeys (array, index);
- }
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (dictionary);
- }
-
- void ICollection<TKey>.Add (TKey item)
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- void ICollection<TKey>.Clear ()
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- bool ICollection<TKey>.Contains (TKey item)
- {
- return dictionary.ContainsKey (item);
- }
-
- bool ICollection<TKey>.Remove (TKey item)
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator ()
- {
- return this.GetEnumerator ();
- }
-
- void ICollection.CopyTo (Array array, int index)
- {
- var target = array as TKey [];
- if (target != null) {
- CopyTo (target, index);
- return;
- }
-
- dictionary.CopyToCheck (array, index);
- dictionary.Do_ICollectionCopyTo<TKey> (array, index, pick_key);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return this.GetEnumerator ();
- }
-
- public int Count {
- get { return dictionary.Count; }
- }
-
- bool ICollection<TKey>.IsReadOnly {
- get { return true; }
- }
-
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return ((ICollection) dictionary).SyncRoot; }
- }
-
- [Serializable]
- public struct Enumerator : IEnumerator<TKey>, IDisposable, IEnumerator {
- Dictionary<TKey, TValue>.Enumerator host_enumerator;
-
- internal Enumerator (Dictionary<TKey, TValue> host)
- {
- host_enumerator = host.GetEnumerator ();
- }
-
- public void Dispose ()
- {
- host_enumerator.Dispose ();
- }
-
- public bool MoveNext ()
- {
- return host_enumerator.MoveNext ();
- }
-
- public TKey Current {
- get { return host_enumerator.current.Key; }
- }
-
- object IEnumerator.Current {
- get { return host_enumerator.CurrentKey; }
- }
-
- void IEnumerator.Reset ()
- {
- host_enumerator.Reset ();
- }
- }
- }
-
- // This collection is a read only collection
- [Serializable]
- [DebuggerDisplay ("Count={Count}")]
- [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
- public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, ICollection, IEnumerable {
- Dictionary<TKey, TValue> dictionary;
-
- public ValueCollection (Dictionary<TKey, TValue> dictionary)
- {
- if (dictionary == null)
- throw new ArgumentNullException ("dictionary");
- this.dictionary = dictionary;
- }
-
- public void CopyTo (TValue [] array, int index)
- {
- dictionary.CopyToCheck (array, index);
- dictionary.CopyValues (array, index);
- }
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (dictionary);
- }
-
- void ICollection<TValue>.Add (TValue item)
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- void ICollection<TValue>.Clear ()
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- bool ICollection<TValue>.Contains (TValue item)
- {
- return dictionary.ContainsValue (item);
- }
-
- bool ICollection<TValue>.Remove (TValue item)
- {
- throw new NotSupportedException ("this is a read-only collection");
- }
-
- IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator ()
- {
- return this.GetEnumerator ();
- }
-
- void ICollection.CopyTo (Array array, int index)
- {
- var target = array as TValue [];
- if (target != null) {
- CopyTo (target, index);
- return;
- }
-
- dictionary.CopyToCheck (array, index);
- dictionary.Do_ICollectionCopyTo<TValue> (array, index, pick_value);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return this.GetEnumerator ();
- }
-
- public int Count {
- get { return dictionary.Count; }
- }
-
- bool ICollection<TValue>.IsReadOnly {
- get { return true; }
- }
-
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return ((ICollection) dictionary).SyncRoot; }
- }
-
- [Serializable]
- public struct Enumerator : IEnumerator<TValue>, IDisposable, IEnumerator {
- Dictionary<TKey, TValue>.Enumerator host_enumerator;
-
- internal Enumerator (Dictionary<TKey,TValue> host)
- {
- host_enumerator = host.GetEnumerator ();
- }
-
- public void Dispose ()
- {
- host_enumerator.Dispose ();
- }
-
- public bool MoveNext ()
- {
- return host_enumerator.MoveNext ();
- }
-
- public TValue Current {
- get { return host_enumerator.current.Value; }
- }
-
- object IEnumerator.Current {
- get { return host_enumerator.CurrentValue; }
- }
-
- void IEnumerator.Reset ()
- {
- host_enumerator.Reset ();
- }
- }
- }
- }
-}
+++ /dev/null
-// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Collections.Generic.ICollection
-//
-// Author:
-// Martin Baulig (martin@ximian.com)
-//
-// (C) 2003 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface ICollection<T> : IEnumerable<T>
- {
- int Count {
- get;
- }
-
- bool IsReadOnly {
- get;
- }
-
- void Add (T item);
-
- void Clear ();
-
- bool Contains (T item);
-
- void CopyTo (T[] array, int arrayIndex);
-
- bool Remove (T item);
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.IComparer
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-// Marek Safar (marek.safar@gmail.com)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IComparer<in T>
- {
- int Compare (T x, T y);
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.IDictionary
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IDictionary<TKey,TValue> : ICollection<KeyValuePair<TKey,TValue>>
- {
-
- void Add (TKey key, TValue value);
- bool ContainsKey (TKey key);
- bool Remove (TKey key);
- bool TryGetValue (TKey key, out TValue value);
- TValue this[TKey key] { get; set; }
- ICollection<TKey> Keys { get; }
- ICollection<TValue> Values { get; }
- }
-}
+++ /dev/null
-// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Collections.Generic.IEnumerable
-//
-// Author:
-// Martin Baulig (martin@ximian.com)
-// Marek Safar (marek.safar@gmail.com)
-//
-// (C) 2003 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IEnumerable<out T> : IEnumerable
- {
- new IEnumerator<T> GetEnumerator ();
- }
-}
+++ /dev/null
-// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Collections.Generic.IEnumerator
-//
-// Author:
-// Martin Baulig (martin@ximian.com)
-// Marek Safar (marek.safar@gmail.com)
-//
-// (C) 2003 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IEnumerator<out T> : IDisposable, IEnumerator
- {
- new T Current {
- get;
- }
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.IEqualityComparer
-//
-// Authors:
-// Ben Maurer (bmaurer@novell.com)
-// Marek Safar (marek.safar@gmail.com)
-//
-// (C) 2005 Ben Maurer
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IEqualityComparer<in T>
- {
- bool Equals (T x, T y);
- int GetHashCode (T obj);
- }
-}
+++ /dev/null
-// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
-//
-// System.Collections.Generic.IList
-//
-// Author:
-// Martin Baulig (martin@ximian.com)
-//
-// (C) 2003 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- public interface IList<T> : ICollection<T>
- {
- int IndexOf (T item);
-
- void Insert (int index, T item);
-
- void RemoveAt (int index);
-
- T this [int index] {
- get; set;
- }
- }
-}
+++ /dev/null
-//
-// IReadOnlyCollection.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Collections.Generic
-{
- public interface IReadOnlyCollection<out T> : IEnumerable<T>
- {
- int Count { get; }
- }
-}
-
+++ /dev/null
-//
-// IReadOnlyDictionary.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2011 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Collections.Generic
-{
- public interface IReadOnlyDictionary<TKey, TValue> : IReadOnlyCollection<KeyValuePair<TKey, TValue>>
- {
- TValue this [TKey key] { get; }
- IEnumerable<TKey> Keys { get; }
- IEnumerable<TValue> Values { get; }
-
- bool ContainsKey (TKey key);
- bool TryGetValue (TKey key, out TValue value);
- }
-}
-
+++ /dev/null
-//
-// IReadOnlyList.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2011 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-namespace System.Collections.Generic
-{
- public interface IReadOnlyList<out T> : IReadOnlyCollection<T>
- {
- T this [int index] { get; }
- }
-}
-
+++ /dev/null
-//
-// System.Collections.Generic.KeyNotFoundException.cs
-//
-// Author:
-// Duncan Mak (duncan@ximian.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-
-namespace System.Collections.Generic {
- [ComVisible(true)]
- [Serializable]
- public class KeyNotFoundException : SystemException, ISerializable {
- public KeyNotFoundException ()
- : base ("The given key was not present in the dictionary.") {}
-
- public KeyNotFoundException (string message)
- : base (message) {}
-
- public KeyNotFoundException (string message, Exception innerException)
- : base (message, innerException) {}
-
- protected KeyNotFoundException (SerializationInfo info, StreamingContext context)
- : base (info, context) {}
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.KeyValuePair
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Diagnostics;
-
-namespace System.Collections.Generic {
- [Serializable]
- public struct KeyValuePair<TKey,TValue> {
- private TKey key;
- private TValue value;
-
- public TKey Key {
- get { return key; }
- private set { key = value; }
- }
-
- public TValue Value {
- get { return value; }
- private set { this.value = value; }
- }
-
- public KeyValuePair (TKey key, TValue value)
- {
- this.key = key;
- this.value = value;
- }
-
- public override string ToString()
- {
- return "[" + (Key != null ? Key.ToString() : string.Empty) + ", " + (Value != null ? Value.ToString() : string.Empty) + "]";
- }
- }
-}
+++ /dev/null
-//
-// System.Collections.Generic.List
-//
-// Authors:
-// Ben Maurer (bmaurer@ximian.com)
-// Martin Baulig (martin@ximian.com)
-// Carlos Alberto Cortez (calberto.cortez@gmail.com)
-// David Waite (mass@akuma.org)
-// Marek Safar (marek.safar@gmail.com)
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2005 David Waite
-// Copyright (C) 2011,2012 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections.ObjectModel;
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace System.Collections.Generic {
- [Serializable]
- [DebuggerDisplay ("Count={Count}")]
- [DebuggerTypeProxy (typeof (CollectionDebuggerView<>))]
- public class List<T> : IList<T>, IList
- , IReadOnlyList<T>
- {
- T [] _items;
- int _size;
- int _version;
-
- const int DefaultCapacity = 4;
-
- public List ()
- {
- _items = EmptyArray<T>.Value;
- }
-
- public List (IEnumerable <T> collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
-
- // initialize to needed size (if determinable)
- ICollection <T> c = collection as ICollection <T>;
- if (c == null) {
- _items = EmptyArray<T>.Value;;
- AddEnumerable (collection);
- } else {
- _size = c.Count;
- _items = new T [_size];
- c.CopyTo (_items, 0);
- }
- }
-
- public List (int capacity)
- {
- if (capacity < 0)
- throw new ArgumentOutOfRangeException ("capacity");
- _items = new T [capacity];
- }
-
- internal List (T [] data, int size)
- {
- _items = data;
- _size = size;
- }
-
- public void Add (T item)
- {
- // If we check to see if we need to grow before trying to grow
- // we can speed things up by 25%
- if (_size == _items.Length)
- GrowIfNeeded (1);
- _items [_size++] = item;
- _version++;
- }
-
- void GrowIfNeeded (int newCount)
- {
- int minimumSize = _size + newCount;
- if (minimumSize > _items.Length)
- Capacity = Math.Max (Math.Max (Capacity * 2, DefaultCapacity), minimumSize);
- }
-
- void CheckRange (int idx, int count)
- {
- if (idx < 0)
- throw new ArgumentOutOfRangeException ("index");
-
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- if ((uint) idx + (uint) count > (uint) _size)
- throw new ArgumentException ("index and count exceed length of list");
- }
-
- void CheckRangeOutOfRange (int idx, int count)
- {
- if (idx < 0)
- throw new ArgumentOutOfRangeException ("index");
-
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- if ((uint) idx + (uint) count > (uint) _size)
- throw new ArgumentOutOfRangeException ("index and count exceed length of list");
- }
-
- void AddCollection (ICollection <T> collection)
- {
- int collectionCount = collection.Count;
- if (collectionCount == 0)
- return;
-
- GrowIfNeeded (collectionCount);
- collection.CopyTo (_items, _size);
- _size += collectionCount;
- }
-
- void AddEnumerable (IEnumerable <T> enumerable)
- {
- foreach (T t in enumerable)
- {
- Add (t);
- }
- }
-
- public void AddRange (IEnumerable <T> collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
-
- ICollection <T> c = collection as ICollection <T>;
- if (c != null)
- AddCollection (c);
- else
- AddEnumerable (collection);
- _version++;
- }
-
- public ReadOnlyCollection <T> AsReadOnly ()
- {
- return new ReadOnlyCollection <T> (this);
- }
-
- public int BinarySearch (T item)
- {
- return Array.BinarySearch <T> (_items, 0, _size, item);
- }
-
- public int BinarySearch (T item, IComparer <T> comparer)
- {
- return Array.BinarySearch <T> (_items, 0, _size, item, comparer);
- }
-
- public int BinarySearch (int index, int count, T item, IComparer <T> comparer)
- {
- CheckRange (index, count);
- return Array.BinarySearch <T> (_items, index, count, item, comparer);
- }
-
- public void Clear ()
- {
- Array.Clear (_items, 0, _items.Length);
- _size = 0;
- _version++;
- }
-
- public bool Contains (T item)
- {
- return Array.IndexOf<T>(_items, item, 0, _size) != -1;
- }
-
- public List <TOutput> ConvertAll <TOutput> (Converter <T, TOutput> converter)
- {
- if (converter == null)
- throw new ArgumentNullException ("converter");
- List <TOutput> u = new List <TOutput> (_size);
- for (int i = 0; i < _size; i++)
- u._items[i] = converter(_items[i]);
-
- u._size = _size;
- return u;
- }
-
- public void CopyTo (T [] array)
- {
- Array.Copy (_items, 0, array, 0, _size);
- }
-
- public void CopyTo (T [] array, int arrayIndex)
- {
- Array.Copy (_items, 0, array, arrayIndex, _size);
- }
-
- public void CopyTo (int index, T [] array, int arrayIndex, int count)
- {
- CheckRange (index, count);
- Array.Copy (_items, index, array, arrayIndex, count);
- }
-
- public bool Exists (Predicate <T> match)
- {
- CheckMatch(match);
-
- for (int i = 0; i < _size; i++) {
- var item = _items [i];
- if (match (item))
- return true;
- }
-
- return false;
- }
-
- public T Find (Predicate <T> match)
- {
- CheckMatch(match);
-
- for (int i = 0; i < _size; i++) {
- var item = _items [i];
- if (match (item))
- return item;
- }
-
- return default (T);
- }
-
- static void CheckMatch (Predicate <T> match)
- {
- if (match == null)
- throw new ArgumentNullException ("match");
- }
-
- public List <T> FindAll (Predicate <T> match)
- {
- CheckMatch (match);
- if (this._size <= 0x10000) // <= 8 * 1024 * 8 (8k in stack)
- return this.FindAllStackBits (match);
- else
- return this.FindAllList (match);
- }
-
- private List <T> FindAllStackBits (Predicate <T> match)
- {
- unsafe
- {
- uint *bits = stackalloc uint [(this._size / 32) + 1];
- uint *ptr = bits;
- int found = 0;
- uint bitmask = 0x80000000;
-
- for (int i = 0; i < this._size; i++)
- {
- if (match (this._items [i]))
- {
- (*ptr) = (*ptr) | bitmask;
- found++;
- }
-
- bitmask = bitmask >> 1;
- if (bitmask == 0)
- {
- ptr++;
- bitmask = 0x80000000;
- }
- }
-
- T [] results = new T [found];
- bitmask = 0x80000000;
- ptr = bits;
- int j = 0;
- for (int i = 0; i < this._size && j < found; i++)
- {
- if (((*ptr) & bitmask) == bitmask)
- results [j++] = this._items [i];
-
- bitmask = bitmask >> 1;
- if (bitmask == 0)
- {
- ptr++;
- bitmask = 0x80000000;
- }
- }
-
- return new List <T> (results, found);
- }
- }
-
- private List <T> FindAllList (Predicate <T> match)
- {
- List <T> results = new List <T> ();
- for (int i = 0; i < this._size; i++)
- if (match (this._items [i]))
- results.Add (this._items [i]);
-
- return results;
- }
-
- public int FindIndex (Predicate <T> match)
- {
- CheckMatch (match);
- return Array.GetIndex (_items, 0, _size, match);
- }
-
- public int FindIndex (int startIndex, Predicate <T> match)
- {
- CheckMatch (match);
- CheckStartIndex (startIndex);
- return Array.GetIndex (_items, startIndex, _size - startIndex, match);
- }
- public int FindIndex (int startIndex, int count, Predicate <T> match)
- {
- CheckMatch (match);
- CheckRangeOutOfRange (startIndex, count);
- return Array.GetIndex (_items, startIndex, count, match);
- }
-
- public T FindLast (Predicate <T> match)
- {
- CheckMatch (match);
- int i = Array.GetLastIndex (_items, 0, _size, match);
- return i == -1 ? default (T) : this [i];
- }
-
- public int FindLastIndex (Predicate <T> match)
- {
- CheckMatch (match);
- return Array.GetLastIndex (_items, 0, _size, match);
- }
-
- public int FindLastIndex (int startIndex, Predicate <T> match)
- {
- CheckMatch (match);
- CheckStartIndex (startIndex);
- return Array.GetLastIndex (_items, 0, startIndex + 1, match);
- }
-
- public int FindLastIndex (int startIndex, int count, Predicate <T> match)
- {
- CheckMatch (match);
- CheckStartIndex (startIndex);
-
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- if (startIndex - count + 1 < 0)
- throw new ArgumentOutOfRangeException ("count must refer to a location within the collection");
-
- return Array.GetLastIndex (_items, startIndex - count + 1, count, match);
- }
-
- public void ForEach (Action<T> action)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
-
- var version =_version;
- for (int i = 0; i < _size; i++) {
- if (_version != version)
- throw Enumerator.GetModifiedCollectionException ();
-
- action (_items [i]);
- }
- }
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- public List <T> GetRange (int index, int count)
- {
- CheckRange (index, count);
- T [] tmpArray = new T [count];
- Array.Copy (_items, index, tmpArray, 0, count);
- return new List <T> (tmpArray, count);
- }
-
- public int IndexOf (T item)
- {
- return Array.IndexOf<T> (_items, item, 0, _size);
- }
-
- public int IndexOf (T item, int index)
- {
- CheckIndex (index);
- return Array.IndexOf<T> (_items, item, index, _size - index);
- }
-
- public int IndexOf (T item, int index, int count)
- {
- if (index < 0)
- throw new ArgumentOutOfRangeException ("index");
-
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- if ((uint) index + (uint) count > (uint) _size)
- throw new ArgumentOutOfRangeException ("index and count exceed length of list");
-
- return Array.IndexOf<T> (_items, item, index, count);
- }
-
- void Shift (int start, int delta)
- {
- if (delta < 0)
- start -= delta;
-
- if (start < _size)
- Array.Copy (_items, start, _items, start + delta, _size - start);
-
- _size += delta;
-
- if (delta < 0)
- Array.Clear (_items, _size, -delta);
- }
-
- void CheckIndex (int index)
- {
- if (index < 0 || (uint) index > (uint) _size)
- throw new ArgumentOutOfRangeException ("index");
- }
-
- void CheckStartIndex (int index)
- {
- if (index < 0 || (uint) index > (uint) _size)
- throw new ArgumentOutOfRangeException ("startIndex");
- }
-
- public void Insert (int index, T item)
- {
- CheckIndex (index);
- if (_size == _items.Length)
- GrowIfNeeded (1);
- Shift (index, 1);
- _items[index] = item;
- _version++;
- }
-
- public void InsertRange (int index, IEnumerable <T> collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
-
- CheckIndex (index);
- if (collection == this) {
- T[] buffer = new T[_size];
- CopyTo (buffer, 0);
- GrowIfNeeded (_size);
- Shift (index, buffer.Length);
- Array.Copy (buffer, 0, _items, index, buffer.Length);
- } else {
- ICollection <T> c = collection as ICollection <T>;
- if (c != null)
- InsertCollection (index, c);
- else
- InsertEnumeration (index, collection);
- }
- _version++;
- }
-
- void InsertCollection (int index, ICollection <T> collection)
- {
- int collectionCount = collection.Count;
- GrowIfNeeded (collectionCount);
-
- Shift (index, collectionCount);
- collection.CopyTo (_items, index);
- }
-
- void InsertEnumeration (int index, IEnumerable <T> enumerable)
- {
- foreach (T t in enumerable)
- Insert (index++, t);
- }
-
- public int LastIndexOf (T item)
- {
- if (_size == 0)
- return -1;
- return Array.LastIndexOf<T> (_items, item, _size - 1, _size);
- }
-
- public int LastIndexOf (T item, int index)
- {
- CheckIndex (index);
- return Array.LastIndexOf<T> (_items, item, index, index + 1);
- }
-
- public int LastIndexOf (T item, int index, int count)
- {
- if (index < 0)
- throw new ArgumentOutOfRangeException ("index", index, "index is negative");
-
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count", count, "count is negative");
-
- if (index - count + 1 < 0)
- throw new ArgumentOutOfRangeException ("cound", count, "count is too large");
-
- return Array.LastIndexOf<T> (_items, item, index, count);
- }
-
- public bool Remove (T item)
- {
- int loc = IndexOf (item);
- if (loc != -1)
- RemoveAt (loc);
-
- return loc != -1;
- }
-
- public int RemoveAll (Predicate <T> match)
- {
- CheckMatch(match);
- int i = 0;
- int j = 0;
-
- // Find the first item to remove
- for (i = 0; i < _size; i++)
- if (match(_items[i]))
- break;
-
- if (i == _size)
- return 0;
-
- _version++;
-
- // Remove any additional items
- for (j = i + 1; j < _size; j++)
- {
- if (!match(_items[j]))
- _items[i++] = _items[j];
- }
- if (j - i > 0)
- Array.Clear (_items, i, j - i);
-
- _size = i;
- return (j - i);
- }
-
- public void RemoveAt (int index)
- {
- if (index < 0 || (uint)index >= (uint)_size)
- throw new ArgumentOutOfRangeException("index");
- Shift (index, -1);
- Array.Clear (_items, _size, 1);
- _version++;
- }
-
- public void RemoveRange (int index, int count)
- {
- CheckRange (index, count);
- if (count > 0) {
- Shift (index, -count);
- Array.Clear (_items, _size, count);
- _version++;
- }
- }
-
- public void Reverse ()
- {
- Array.Reverse (_items, 0, _size);
- _version++;
- }
- public void Reverse (int index, int count)
- {
- CheckRange (index, count);
- Array.Reverse (_items, index, count);
- _version++;
- }
-
- public void Sort ()
- {
- Array.Sort<T> (_items, 0, _size);
- _version++;
- }
- public void Sort (IComparer <T> comparer)
- {
- Array.Sort<T> (_items, 0, _size, comparer);
- _version++;
- }
-
- public void Sort (Comparison <T> comparison)
- {
- if (comparison == null)
- throw new ArgumentNullException ("comparison");
-
- Array.SortImpl<T> (_items, _size, comparison);
- _version++;
- }
-
- public void Sort (int index, int count, IComparer <T> comparer)
- {
- CheckRange (index, count);
- Array.Sort<T> (_items, index, count, comparer);
- _version++;
- }
-
- public T [] ToArray ()
- {
- T [] t = new T [_size];
- Array.Copy (_items, t, _size);
-
- return t;
- }
-
- public void TrimExcess ()
- {
- Capacity = _size;
- }
-
- public bool TrueForAll (Predicate <T> match)
- {
- CheckMatch (match);
-
- for (int i = 0; i < _size; i++)
- if (!match(_items[i]))
- return false;
-
- return true;
- }
-
- public int Capacity {
- get {
- return _items.Length;
- }
- set {
- if ((uint) value < (uint) _size)
- throw new ArgumentOutOfRangeException ();
-
- Array.Resize (ref _items, value);
- }
- }
-
- public int Count {
- get { return _size; }
- }
-
- public T this [int index] {
- [MethodImpl ((MethodImplOptions)256)]
- get {
- if ((uint) index >= (uint) _size)
- throw new ArgumentOutOfRangeException ("index");
- return Array.UnsafeLoad (_items, index);
- }
-
- [MethodImpl ((MethodImplOptions)256)]
- set {
- if ((uint) index >= (uint) _size)
- throw new ArgumentOutOfRangeException ("index");
- _items [index] = value;
- _version++;
- }
- }
-
-#region Interface implementations.
- IEnumerator <T> IEnumerable <T>.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- void ICollection.CopyTo (Array array, int arrayIndex)
- {
- if (array == null)
- throw new ArgumentNullException ("array");
- if (array.Rank > 1 || array.GetLowerBound (0) != 0)
- throw new ArgumentException ("Array must be zero based and single dimentional", "array");
- Array.Copy (_items, 0, array, arrayIndex, _size);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- int IList.Add (object item)
- {
- try {
- Add ((T) item);
- return _size - 1;
- } catch (NullReferenceException) {
- } catch (InvalidCastException) {
- }
- throw new ArgumentException ("item");
- }
-
- bool IList.Contains (object item)
- {
- try {
- return Contains ((T) item);
- } catch (NullReferenceException) {
- } catch (InvalidCastException) {
- }
- return false;
- }
-
- int IList.IndexOf (object item)
- {
- try {
- return IndexOf ((T) item);
- } catch (NullReferenceException) {
- } catch (InvalidCastException) {
- }
- return -1;
- }
-
- void IList.Insert (int index, object item)
- {
- // We need to check this first because, even if the
- // item is null or not the correct type, we need to
- // return an ArgumentOutOfRange exception if the
- // index is out of range
- CheckIndex (index);
- try {
- Insert (index, (T) item);
- return;
- } catch (NullReferenceException) {
- } catch (InvalidCastException) {
- }
- throw new ArgumentException ("item");
- }
-
- void IList.Remove (object item)
- {
- try {
- Remove ((T) item);
- return;
- } catch (NullReferenceException) {
- } catch (InvalidCastException) {
- }
- // Swallow the exception--if we can't cast to the
- // correct type then we've already "succeeded" in
- // removing the item from the List.
- }
-
- bool ICollection <T>.IsReadOnly {
- get { return false; }
- }
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return this; }
- }
- bool IList.IsFixedSize {
- get { return false; }
- }
-
- bool IList.IsReadOnly {
- get { return false; }
- }
-
- object IList.this [int index] {
- get { return this [index]; }
- set {
- try {
- this [index] = (T) value;
- return;
- } catch (NullReferenceException) {
- // can happen when 'value' is null and T is a valuetype
- } catch (InvalidCastException) {
- }
- throw new ArgumentException ("value");
- }
- }
-#endregion
-
- [Serializable]
- public struct Enumerator : IEnumerator <T>, IDisposable {
- readonly List<T> l;
- int next;
- readonly int ver;
-
- T current;
-
- internal Enumerator (List <T> l)
- : this ()
- {
- this.l = l;
- ver = l._version;
- }
-
- public void Dispose ()
- {
- }
-
- public bool MoveNext ()
- {
- var list = l;
-
- if ((uint)next < (uint)list._size && ver == list._version) {
- current = list._items [next++];
- return true;
- }
-
- if (ver != l._version)
- throw GetModifiedCollectionException ();
-
- next = -1;
- return false;
- }
-
- public T Current {
- get { return current; }
- }
-
- void IEnumerator.Reset ()
- {
- if (ver != l._version)
- throw GetModifiedCollectionException ();
-
- next = 0;
- current = default (T);
- }
-
- object IEnumerator.Current {
- get {
- if (ver != l._version)
- throw GetModifiedCollectionException ();
-
- if (next <= 0)
- throw new InvalidOperationException ();
- return current;
- }
- }
-
- internal static InvalidOperationException GetModifiedCollectionException ()
- {
- return new InvalidOperationException ("Collection was modified; enumeration operation may not execute.");
- }
- }
- }
-}
private string _cached_str;
private int _maxCapacity;
- private const int constDefaultCapacity = 16;
+ internal const int DefaultCapacity = 16;
public StringBuilder(string value, int startIndex, int length, int capacity)
: this (value, startIndex, length, capacity, Int32.MaxValue)
throw new System.ArgumentOutOfRangeException ("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
if (capacity == 0) {
- if (maxCapacity > constDefaultCapacity)
- capacity = constDefaultCapacity;
+ if (maxCapacity > DefaultCapacity)
+ capacity = DefaultCapacity;
else
_str = _cached_str = String.Empty;
}
public int Capacity {
get {
if (_str.Length == 0)
- return Math.Min (_maxCapacity, constDefaultCapacity);
+ return Math.Min (_maxCapacity, DefaultCapacity);
return _str.Length;
}
// The first time a string is appended, we just set _cached_str
// and _str to it. This allows us to do some optimizations.
// Below, we take this into account.
- if ((object) _cached_str == (object) _str && capacity < constDefaultCapacity)
- capacity = constDefaultCapacity;
+ if ((object) _cached_str == (object) _str && capacity < DefaultCapacity)
+ capacity = DefaultCapacity;
capacity = capacity << 1;
if (size > capacity)
int source_pos = sourceIndex - sourceArray.GetLowerBound (0);
int dest_pos = destinationIndex - destinationArray.GetLowerBound (0);
+ if (dest_pos < 0)
+ throw new ArgumentOutOfRangeException ("destinationIndex", "Index was less than the array's lower bound in the first dimension.");
+
// re-ordered to avoid possible integer overflow
if (source_pos > sourceArray.Length - length)
throw new ArgumentException ("length");
[ReliabilityContractAttribute (Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Copy (Array sourceArray, long sourceIndex, Array destinationArray,
- long destinationIndex, long length)
+ long destinationIndex, long length)
{
if (sourceArray == null)
throw new ArgumentNullException ("sourceArray");
public object Current {
get {
- // Exception messages based on MS implementation
+ // Exception messages based on MS implementation
if (currentpos < 0 )
throw new InvalidOperationException (Locale.GetText (
"Enumeration has not started."));
}
#endregion
+
+ internal sealed class FunctorComparer<T> : IComparer<T> {
+ Comparison<T> comparison;
+
+ public FunctorComparer(Comparison<T> comparison) {
+ this.comparison = comparison;
+ }
+
+ public int Compare(T x, T y) {
+ return comparison(x, y);
+ }
+ }
}
}
}
[Test]
- [ExpectedException (typeof (ArgumentException))]
+ [ExpectedException (typeof (ArgumentNullException))]
public void IDictionary_Add_Null_2 ()
{
IDictionary d = new Dictionary<int, int> ();
c.CopyTo (new MyClass [1], 0);
}
- [Test, ExpectedException (typeof (ArgumentException))]
public void ICollectionCopyTo_ex1 ()
{
var d = new Dictionary<int, string> ();
list.Insert(0, new object());
}
- [Test, ExpectedException(typeof (ArgumentException))]
+ [Test, ExpectedException(typeof (ArgumentNullException))]
public void IList_InsertInvalidType2 ()
{
IList list = _list1 as IList;
list.Add(new object());
}
- [Test, ExpectedException(typeof (ArgumentException))]
+ [Test, ExpectedException(typeof (ArgumentNullException))]
public void IList_AddInvalidType2()
{
IList list = _list1 as IList;
x.CopyTo (Array.CreateInstance (typeof (int), new int [] { 10 }, new int[] { 1 }), 0);
Assert.Fail ("#7");
} catch (Exception e) {
- Assert.IsTrue (e is ArgumentException, "#8");
+ Assert.IsTrue (e is ArgumentOutOfRangeException, "#8");
}
l.Add (10); l.Add (20);
System.Threading/WaitCallback.cs
System.Threading/WaitHandle.cs
System.Threading/WaitOrTimerCallback.cs
-System.Collections.Generic/CollectionDebuggerView.cs
-System.Collections.Generic/Dictionary.cs
-System.Collections.Generic/ICollection.cs
-System.Collections.Generic/IEnumerable.cs
-System.Collections.Generic/IEnumerator.cs
-System.Collections.Generic/IList.cs
-System.Collections.Generic/IComparer.cs
-System.Collections.Generic/IEqualityComparer.cs
-System.Collections.Generic/IDictionary.cs
-System.Collections.Generic/IReadOnlyCollection.cs
-System.Collections.Generic/IReadOnlyList.cs
-System.Collections.Generic/IReadOnlyDictionary.cs
-System.Collections.Generic/KeyValuePair.cs
-System.Collections.Generic/EqualityComparer.cs
-System.Collections.Generic/KeyNotFoundException.cs
-System.Collections.Generic/List.cs
System/Action.cs
System/Comparison.cs
System/Converter.cs
System/Predicate.cs
System.Collections.Generic/Comparer.cs
+System.Collections.Generic/EqualityComparer.cs
System.Threading.Tasks/DecoupledTask.cs
System.Threading.Tasks/TaskConstants.cs
../../../external/referencesource/mscorlib/system/collections/structuralcomparisons.cs
../../../external/referencesource/mscorlib/system/collections/generic/debugview.cs
+../../../external/referencesource/mscorlib/system/collections/generic/dictionary.cs
+../../../external/referencesource/mscorlib/system/collections/generic/icollection.cs
+../../../external/referencesource/mscorlib/system/collections/generic/icomparer.cs
+../../../external/referencesource/mscorlib/system/collections/generic/idictionary.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ienumerable.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ienumerator.cs
+../../../external/referencesource/mscorlib/system/collections/generic/iequalitycomparer.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ilist.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ireadonlycollection.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ireadonlydictionary.cs
+../../../external/referencesource/mscorlib/system/collections/generic/ireadonlylist.cs
+../../../external/referencesource/mscorlib/system/collections/generic/keynotfoundexception.cs
+../../../external/referencesource/mscorlib/system/collections/generic/keyvaluepair.cs
+../../../external/referencesource/mscorlib/system/collections/generic/list.cs
+
../../../external/referencesource/mscorlib/system/collections/Concurrent/ConcurrentDictionary.cs
../../../external/referencesource/mscorlib/system/collections/Concurrent/ConcurrentQueue.cs
../../../external/referencesource/mscorlib/system/collections/Concurrent/ConcurrentStack.cs
../../../external/referencesource/mscorlib/system/runtime/compilerservices/unsafevaluetypeattribute.cs
../../../external/referencesource/mscorlib/system/runtime/compilerservices/YieldAwaitable.cs
+../../../external/referencesource/mscorlib/system/text/stringbuildercache.cs
+
../../../external/referencesource/mscorlib/system/threading/abandonedmutexexception.cs
../../../external/referencesource/mscorlib/system/threading/apartmentstate.cs
../../../external/referencesource/mscorlib/system/threading/autoresetevent.cs