First of all I am not insane or stupid (at least I hope not) I have been using .net for a few years and this is the funkiest thing that I have ever seen.
The code snippet that I have embedded is only the portion of the actual class code that I believe is affected.
The Left property of Expression should only return 13 items in the arraylist. My problem is that it is returning 26. I have placed a breakpoint in Public Function Simplify on line ES.Add(Left) and
have stepped through the code and everything works perfectly until it gets to
the return statement of the Property Left. At this point Left.count automatically jumps to 26!
Now the crazy part is that after it hits the breakpoint and the code is no longer executing I can place my cursor over the property Left in the line ES.Add(Left) then remove the cursor and if I place it back again the small message that appears over Left that shows how many element are contained in it starts to increment by 13. If I look in the watch window it shows me that Left still has only 13 elements in it.
I am totally lost. I not only want to fix the problem but I am also interested to know what the heck is going on.
Public Class Expression
Private _Left As New ArrayList
Private _Terms As ArrayList
Public ReadOnly Property Left() As ArrayList
For Each item As Term In _Terms
If item.LeftSide Then
Public Function Simplify() As ArrayList
Dim ES As New ArrayList
ES.Add(Left) 'array of arrays