Commit Graph
193 Commits
Author SHA1 Message Date
Marek Safar fa19bfd400 [corlib] Tweak Dictionary initial capacity to be more conservative. Fixes #21375 2014-07-21 20:35:14 +02:00
Marek Safar 6169424b4c [corlib] Optimize EqualityComparer for common value types. Fixes #18400 2014-03-19 23:11:00 +01:00
Simon Hartmann 11b5312c83 Bug 17838 - IDictionary item property implemention for ConcurrentDictionary/SortedList_T throws exception on non-existing key
Avoid double lookup for Dictionary IDictionary.get_Item property impl
2014-02-19 16:40:57 +01:00
Marek Safar 27feeb5a9a [corlib] Reset List enumerator current field. Fixes #17760 2014-02-13 22:26:13 +01:00
Marek Safar f43d02d563 [corlib] Default comparer uses IComparable interface only 2014-02-07 20:07:45 +01:00
Marek Safar 8006bd5011 [corlib] Set initialized List<T> capacity to match input enumeration. Fixes #16318 2013-11-29 20:40:07 +01:00
Zoltan Varga 454a4c5de7 Fix a problem introduced by c6989ab9f9. Avoid foreach on _items since that includes empty entries too. 2013-09-15 02:42:28 +02:00
Marek Safar c6989ab9f9 Unify Array/List FindIndex/FindLastIndex handling and argument checking. Fixes #14632 2013-09-13 14:51:08 +02:00
Marek Safar cfe97bf3a5 Share more common code 2013-02-27 22:58:31 +01:00
Rodrigo Kumpera 84f51f8c4d We can't use UnsageStore in List<> since broken user code that doesn't sync right will cause heap corruption. 2012-12-14 21:16:48 -05:00
Alan McGovern d6396791ce [corlib] Remove the DebuggerDisplay attribute from KeyValuePair and DictionaryEntry
This attribute gives us a horrible debugging experience when the
'Value' of the KeyValuePair is null. By using this attribute, the
user is told that the KeyValuePair itself is null when they inspect
something like 'new KeyValuePair<string, string> (null, null)'.
This is very confusing.

We should just let the ToString method be invoked, which returns a
nicely formatted string. This is also the behaviour observed when
debugging using Visual Studio.
2012-11-01 15:59:23 +00:00
Marek Safar f46e90b074 Optimize list enumerator 2012-10-04 11:53:14 +01:00
Marek Safar 7883a2dafd Clean up some static initializers 2012-10-03 12:19:55 +01:00
Rodrigo Kumpera f3f5a89d04 Force List<T> accessors to be inlined.
* List.cs: Make sure indexers are always inlined. We use the 256 literal instead
	of MethodImplOptions.AggressiveInlining since the later is only available on 4.5.
2012-10-01 14:28:06 -04:00
Rodrigo Kumpera 2bc8207c26 List<T> accessors now use Array.Unsafe(Load|Store). 2012-10-01 14:28:05 -04:00
Marek Safar 6b762d83bf Simplify range check in list setter 2012-09-17 23:06:26 +01:00
Marek Safar a678643179 Add IReadOnlyCollection interface 2012-06-01 14:07:18 +01:00
Marek Safar 22c09b95aa Implement Comparer::Create 2012-03-19 17:15:49 +00:00
Andres G. Aragoneses 1611e51eec corlib: List's enumerator should not mutate after being disposed
List<T>.Enumerator is a struct so current Dispose() implementation was causing mutability on it.
Depending on this behaviour may seem overkill but some codebases may implement IEnumerator<T> themselves by caching the enumerator of their initial readonly list.

Making Dispose() not do anything may seem incorrect, but it is not. For a good read about this, take a look at Stephen Cleary's first comment in:
http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/f5a59eac-4a3e-4417-99a8-83d4a6a9e41d

(Added NUnit tests that demonstrate the issue too.)

For a good example: this fix makes a simple HelloWorld System.Web.IHttpHandler work in Mono within the OpenRasta framework (at least tested with the stable branch).
2012-03-02 12:50:19 +00:00
Marek Safar b1683b85d3 Remove some unused code 2012-02-24 13:14:08 +00:00
Zoltan Varga 2e0324b2ff Fix List.LastIndexOf () on empty lists. Fixes #2558. 2011-12-19 12:21:31 +01:00
Miguel de Icaza 38edc367c4 Update two days worth of copyrights, many more missing 2011-11-09 10:25:48 -05:00
Sebastien Pouliot aa155736de Workaround AOT limitation for bug #1443. Patch by Rodrigo Kumpera 2011-11-08 07:56:40 -05:00
Marek Safar e1c66efea8 Add 4.5 readonly collection interfaces 2011-09-19 19:34:27 +01:00
Jb Evain 648425ebe1 Fix handling of null in the non generic implementation of EqualityComparer. Fixes 703027. 2011-06-30 01:24:50 +02:00
Jb Evain 106c713c02 Fix bug #699182, List indexer doesn't increment version 2011-06-10 11:11:56 +02:00
Rodrigo Kumpera d72794cced Reorder fields to improve object layout since the runtime can't do it for corlib types. 2011-05-23 01:13:09 -03:00
Rodrigo Kumpera 750ddb7846 Properly check arguments in List<T> ICollection.CopyTo.
* List.cs (ICollection.CopyTo): Properly check
	the array argument to match MS semantics.

	Fixes #672907
2011-02-22 18:48:32 +01:00
Marek Safar d84d7c7eb9 Remove no longer used BOOTSTRAP conditionals 2010-12-29 12:41:12 +00:00
Marek Habersack 238062bfe8 [bug workaround] Fix the build of System.Web.Mvc by renaming internal StringComparer class to InternalStringComparer
The build fails because of what seems to be a bug in gmcs. The compiler reports that
the StringComparer.OrdinalIgnoreCase property doesn't exist and it does so because
gmcs loads the internal System.Collections.Generic.StringComparer from EqualitComparer.cs instead of the
System.StringComparer one.
2010-09-27 00:31:31 +02:00
Miguel de Icaza 1e20a9c660 Fix EqualityComparer for strings.
It turns out that Strings need to explicitly use a version that does
implement EqualityComparer<string> since string is an IEquatable.

Do this, and to avoid the reflection mess, cast to object, then cast
to the real type
2010-09-25 22:44:41 -04:00
Miguel de Icaza aca5a99057 Optimize EqualityComparer for strings
This shortcut prevents the reflection system to kick into action
for compiler generated string switch statements.
2010-09-25 21:08:53 -04:00
Jb Evain 256bbe90bf Remove no-op code 2010-09-08 18:48:27 +02:00
Marek Safar 6d4a4e8e31 2010-06-29 Marek Safar <[email protected]>
* List.cs: Optimize IEnumerable<T> ctor.


svn path=/trunk/mcs/; revision=159651
2010-06-29 08:29:01 +00:00
Marek Safar f9bea41458 2010-05-15 Marek Safar <[email protected]>
* KeyValuePair.cs: Initialize fields definitely.


svn path=/trunk/mcs/; revision=157385
2010-05-15 21:18:13 +00:00
Sebastien Pouliot b1dfcf6b8b In System.Collections:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* CollectionDebuggerView.cs: Change to internal so we can avoid
	a duplicating the type in assemblies that have [InternalsVisibleTo]

In System.Collections.Generic:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* CollectionDebuggerView.cs: Change to internal so we can avoid
	a duplicating the type in assemblies that have [InternalsVisibleTo]


svn path=/trunk/mcs/; revision=153915
2010-03-19 18:54:23 +00:00
Geoff Norton df9d2cd71d Lets ensure we generate some types in AOT when using these valuetypes for MonoTouch
svn path=/trunk/mcs/; revision=152150
2010-02-21 21:00:25 +00:00
Gonzalo Paniagua Javier 4581393bc0 2010-01-25 Gonzalo Paniagua Javier <[email protected]>
* EqualityComparer.cs: (Equals) the arguments are checked to be
	the correct type.


svn path=/trunk/mcs/; revision=150156
2010-01-25 21:07:41 +00:00
Robert Jordan c42abafd5b In System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* Dictionary.cs: Fix deserialization compatibility with MS.NET.
	Fixes bug #474009.

In Test/System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* DictionaryTest.cs: Add test case for bug #474009.


svn path=/trunk/mcs/; revision=150089
2010-01-24 01:04:18 +00:00
Miguel de Icaza 820ad1b041 2010-01-20 Miguel de Icaza <[email protected]>
* Dictionary.cs: Always create the keys, fixes compatibility
       between Mono and .NET.  Patch from John Lenz <[email protected]>


svn path=/trunk/mcs/; revision=149947
2010-01-21 00:49:45 +00:00
Chris Toshok 8718686805 in class/corlib/System.Collections.Generic/:
2009-12-06  Chris Toshok  <[email protected]>

	* 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.

in class/System.ServiceModel.Web/System.Runtime.Serialization.Json/:
2009-12-06  Chris Toshok  <[email protected]>

	* JsonSerializationReader.cs (DeserializeGenericCollection): this
	is jb's (iirc) patch, actually.  Types subclassing from
	ICollection<T> need to be supported, and since it's an interface
	the implementation might be explicit.  So instead of groveling
	around in the actual type, we need to dispatch through the
	interface's method.

	* TypeMap.cs (CreateDefaultTypeMap): we need to include non-public
	properties, since KeyValuePair items must be able to write to Key
	and Value properties.

	* JsonReader.cs (ReadContent): for builtin values (null, true,
	false), use TryReadString instead of individual ReadChar's, since
	they aren't reversible if the string didn't match.  In the default
	case, if we're LameSilverlightLiseralParser, we need to push back
	the current character onto the stream -- this is because for
	netflix's AppConfig.json we were parsing "frameRatePolicy" as
	"rameRatePolicy" (the 'f' was triggering the "false" parsing).
	(class PushBackReader): add this class to unify all the pushing
	back of characters we need to do.  1 character (JsonReader's old
	"saved_char") isn't enough given that you could have a property
	named, e.g., "falsifiable", and we'd need 4 characters worth of
	pushback to recognize that correctly.

svn path=/trunk/mcs/; revision=147766
2009-12-07 07:39:17 +00:00
Marek Safar d00165ebd2 2009-11-26 Marek Safar <[email protected]>
* CollectionDebuggerView.cs: Removed limit restriction.


svn path=/trunk/mcs/; revision=146991
2009-11-26 15:11:22 +00:00
Carlos Alberto Cortez 7ce82fe77f 2009-11-23 Carlos Alberto Cortez <[email protected]>
* Comparer.cs: Our DefaultComparer class should be serializable just
	as the generic one is.
	Fixes #503585.


svn path=/trunk/mcs/; revision=146789
2009-11-24 01:24:08 +00:00
Carlos Alberto Cortez 7d1b43a099 2009-11-23 Juraj Skripsky <[email protected]>
* 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.


svn path=/trunk/mcs/; revision=146704
2009-11-23 06:49:25 +00:00
Juraj Skripsky 016587e4fd 2009-11-08 Juraj Skripsky <[email protected]>
* Array.cs (Sort):
	- Sort(..) without IComparer param call Sort(.., (IComparer)null) siblings
	- Sort(keys, items,..) with items == null call Sort(keys,..) siblings
	Add missing argument checks. Add SortImpl method to be used by
	List<T>.Sort(Comparison <T>).

	Part 3 of 3 fixing bug #351638.

2009-11-08  Juraj Skripsky <[email protected]>

	* List.cs (Sort): Sync to latest changes in Array.Sort.


svn path=/trunk/mcs/; revision=145678
2009-11-08 19:31:32 +00:00
Marek Safar b8e6d96063 4.0 bootstrap
svn path=/trunk/mcs/; revision=144455
2009-10-20 13:04:51 +00:00
Marek Safar 511cd3ef88 2009-10-20 Marek Safar <[email protected]>
* List.cs, CollectionDebuggerView.cs, KeyValuePair.cs, Dictionary.cs
	Improve debugging experience.


svn path=/trunk/mcs/; revision=144437
2009-10-20 10:32:19 +00:00
Marek Safar d519764e4d 2009-10-19 Marek Safar <[email protected]>
* CollectionDebuggerView.cs: New file.


svn path=/trunk/mcs/; revision=144414
2009-10-19 22:07:40 +00:00
Sebastien Pouliot 98dff5513c 2009-10-17 Sebastien Pouliot <[email protected]>
* EqualityComparer.cs: Seal internal classes


svn path=/trunk/mcs/; revision=144308
2009-10-17 15:53:48 +00:00
Miguel de Icaza 0204abe803 Drop more obsolete defines
svn path=/trunk/mcs/; revision=144304
2009-10-17 01:35:27 +00:00