msgbartop
Code that explodes conventions
msgbarbottom

14 Dec 11 An Obscure Bug In DotNet 2.0

Lists are ubiquitous in programming.  In dealing with lists, I've encountered a obscure bug in DotNet 2.0.  When a list is intialized without specifying a size and that list is passed to a function, the returned list is empty.  The list inside the function has all of the added nodes and all of the nodes prior to the function, but none of the nodes added during the function.  The way around this bug is to always initialize lists to a specific number.  If that list should be empty, then pass zero as a parameter.  The problem will go away and you will return to sanity.  If anyone has seem a similar problem in Java, post a comment down below.

ArrayList nonInitializedList = new ArrayList();//will cause the bug
ArrayList initializedArrayList = new ArrayList(0);//alleviates the bug
Loading...
Join thousands and get updates for free...No-Spam Guarantee