[Mono-bugs] [Bug 343960] XPathException removing comment

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 30 04:23:02 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=343960#c6


andrus moor <kobruleht2 at hot.ee> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
             Status|RESOLVED                                        |REOPENED
         Resolution|INVALID                                         |




--- Comment #6 from andrus moor <kobruleht2 at hot.ee>  2007-11-30 02:23:01 MST ---
Chris Sheperd explains:

Actually, it does [make sense]. A cloned IEnumerable instance is *not* the same
IEnumerable, by nature. It may have references to the same data, but it 
does not necessarily contain the same list of references. If you remove 
items from the newly cloned instance, it won't affect its progenitor, 
and vice versa. Kind of the point of clone, really.

Code is functionally working with two different IEnumerable objects. 
Below is an example of effectively what 
original code is doing -- removing a subset of items in one list from 
another list.

class General
{
     class ClassA
     {
         public string name;

         public ClassA(string nm) { this.name = nm; }
     }

     static void Main(string[] args)
     {
         List<ClassA> listOne = new List<ClassA>();
         List<ClassA> listTwo = new List<ClassA>();

         ClassA a = new ClassA("A");
         ClassA b = new ClassA("B");
         ClassA c = new ClassA("C");
         ClassA d = new ClassA("D");
         ClassA e = new ClassA("E");

         listOne.AddRange(new ClassA[] { a, b, c, d, e });
         listTwo.AddRange(new ClassA[] { a, c, d });

         string msg = "Start Length of listOne: " +
             listOne.Count.ToString() +
             "\nStart Length of listTwo: " +
             listTwo.Count.ToString() +
             "\nWhat is removed:\n";
         foreach (ClassA z in listTwo)
         {
             msg += z.name + "\t";
             listOne.Remove(z);
         }

         Console.WriteLine(msg + "\nLength of listOne: " +
             listOne.Count.ToString() +
             "\nLength of listTwo: " +
             listTwo.Count.ToString());
     }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list