<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx</link><description>ArrayList is one of the most commonly used data structure. However there is little information about ArrayList performance characteristics on MSDN. The document on MSDN does mention asymptotic complexity of some methods on ArrayList class, but it doesn’t</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#273539</link><pubDate>Thu, 02 Dec 2004 07:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273539</guid><dc:creator>Sean Chase</dc:creator><description>Thank you for this information!</description></item><item><title>Are all the Collection classes implented the same in rotor and .Net framework?</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#273581</link><pubDate>Thu, 02 Dec 2004 09:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273581</guid><dc:creator>STL_Guy</dc:creator><description>Are all the collection classes implemented the same way in Rotor and the .Net framework? Since this is the BCL team's blog, I'm assuming you would know for sure.&lt;br&gt;&lt;br&gt;BTW I've always disliked the fact the .Net f/w documentation doesn't talk about the time complexities of the collection classes as clearly as the C++ standard's STL part does. Take a look at Bjarne's book and see how clearly he lists out the time complexities of various STL classes and the tradeoff's involved. So here's a difference between a documentation by a programmer versus just a documentation guy who has to pick on the brains of some busy developer for information.&lt;br&gt;&lt;br&gt;Another question I have is why do the Synchronised wrapper classes do a blind lock for every function? Why doesn't it do something smart like a reader write lock etc? For example how does it matter how many threads are simultaneously trying to read the count of a collection? Why go to the cost of an expensive lock for something that is only read by various threads? I was shocked to see the source for some of the synchronised wrappers and see what a trivial implementation it is.&lt;br&gt;&lt;br&gt;I'm hoping someone on the BCL team really reads these blogs and answers questions here.</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#273640</link><pubDate>Thu, 02 Dec 2004 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273640</guid><dc:creator>Paul Rudin</dc:creator><description>Incidentally - here's an apparent ArrayList bug I noticed.&lt;br&gt;&lt;br&gt;&lt;br&gt;Here's some c# code:&lt;br&gt;&lt;br&gt;using System;&lt;br&gt;using System.Collections;&lt;br&gt;namespace AdapterProblem&lt;br&gt;{&lt;br&gt;	class Class1&lt;br&gt;	{&lt;br&gt;		[STAThread]&lt;br&gt;		static void Main(string[] args)&lt;br&gt;		{&lt;br&gt;			ArrayList source = ArrayList.Adapter(new object []  {&amp;quot;1&amp;quot; , &amp;quot;2&amp;quot;});&lt;br&gt;			ArrayList range = source.GetRange(1,1);&lt;br&gt;			ArrayList target = new ArrayList();&lt;br&gt;			target.AddRange(range);&lt;br&gt;			Console.WriteLine(target[0] == null? &amp;quot;It's null&amp;quot; : target[0]);&lt;br&gt;			Console.ReadLine();&lt;br&gt;		}&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;&lt;br&gt;I would expect this to print out the second element of source -&lt;br&gt;i.e. the string &amp;quot;2&amp;quot;. Actually it turns out that target[0] is null so&lt;br&gt;the program prints &amp;quot;It's null&amp;quot;.</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#273933</link><pubDate>Thu, 02 Dec 2004 23:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273933</guid><dc:creator>Michael</dc:creator><description>It seems you can't iterate over an ArrayList that contains itself:&lt;br&gt;&lt;br&gt;ArrayList list = new ArrayList();&lt;br&gt;list.Add(list);&lt;br&gt;foreach (Object obj in list);&lt;br&gt;// ArrayListEnumeratorSimple.get_Current throws InvalidOperationException</description></item><item><title>ArrayList Performance</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#275168</link><pubDate>Sun, 05 Dec 2004 04:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275168</guid><dc:creator>Dominic Plouffe</dc:creator><description>ArrayList Performance</description></item><item><title>Blog link of the week 49</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#275360</link><pubDate>Mon, 06 Dec 2004 01:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275360</guid><dc:creator>Daniel Moth</dc:creator><description>Blog link of the week 49</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#278008</link><pubDate>Wed, 08 Dec 2004 05:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:278008</guid><dc:creator>Gang Peng</dc:creator><description>Paul, the bug is fixed in Whidbey.&lt;br&gt;&lt;br&gt;Michael, the iteration problem is a bug we also fixed in Whidbey. The problem is ArrayListEnumeratorSimple class uses the list to check for boundary conditions. You can take a look at the rotor source for details. &lt;br&gt;&lt;br&gt;Thanks for the feedback.</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#279180</link><pubDate>Fri, 10 Dec 2004 01:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:279180</guid><dc:creator>Luong Luc</dc:creator><description>I'm looking for a technique for determing IndexOF of a class element in an ArrayList of CLASSES  (such as Employee as shown below - not any regular objets).&lt;br&gt;Could you please help me out?&lt;br&gt;&lt;br&gt;Example:&lt;br&gt;public class Employee &lt;br&gt;{&lt;br&gt;String _name;&lt;br&gt;int _id;&lt;br&gt;...........&lt;br&gt;...........&lt;br&gt;public Employee( int id, String name ) &lt;br&gt;{&lt;br&gt;this._name = name;&lt;br&gt;this._id = id;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;Thank you.</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#323142</link><pubDate>Fri, 17 Dec 2004 05:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:323142</guid><dc:creator>Ryan Byington</dc:creator><description>I am not sure I fully understand your question but I will try. IndexOf(Object value) just call value.Equals (assuming value is not null) on every item in ArrayList starting at the begining until Equlas returns true and it returns that index for the item.&lt;br&gt;&lt;br&gt;For your Employee object you will get a reference equals by default from Object to override this behavior simply override Equals method possibly like the following:&lt;br&gt;&lt;br&gt;public override bool Equals(Object other)&lt;br&gt;{&lt;br&gt;	Employee otherEmployee = other as Employee;&lt;br&gt;&lt;br&gt;	if(null == otherEmployee) {&lt;br&gt;		return false;&lt;br&gt;	}&lt;br&gt;&lt;br&gt;	return _name == otherEmployee._name &amp;amp;&amp;amp; _id == otherEmplyee._id;&lt;br&gt;}</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#323250</link><pubDate>Fri, 17 Dec 2004 10:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:323250</guid><dc:creator>Gang Peng</dc:creator><description>As Ryan mentioned, basically IndexOf just calls Object.Equals on the items.&lt;br&gt;So for the type objects, Type.Equals will be used. So it will work just find for ArrayList of type objects.&lt;br&gt;</description></item><item><title>re: System.Collections.ArrayList performance analysis</title><link>http://blogs.msdn.com/bclteam/pages/273454.aspx#331698</link><pubDate>Fri, 24 Dec 2004 14:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:331698</guid><dc:creator>David Taylor</dc:creator><description>Does everything you have said about ArrayList also apply to List&amp;lt;T&amp;gt;?</description></item></channel></rss>