[Mono-list] events and handlers

ville vi64pa@koti.soon.fi
Sat, 14 Dec 2002 16:17:40 +0200

Hi all

I got this problem which i cant understand.

When i run compile and run following program the OnEvent method is invoked 
many times. And it surely shoudl not! I have tested this with others 
(DataRow) and it worked correctly. 

So where is the problem?

It cant be in XmlDocument?
It cant be in mcs, because DataRow works?

using System;
using System.Data;
using System.Xml;

public class Test {

	public static void OnEvent (object sender, XmlNodeChangedEventArgs args)
		Console.WriteLine ("action " + args.Action);

        public static void Main() {

            DataSet RegionDS = new DataSet ();

            XmlDocument DataDoc = new XmlDocument ();
	    DataDoc.NodeInserted -= new XmlNodeChangedEventHandler (OnEvent);
	    DataDoc.Load("region.xml" );
} // End class

Please, help