Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Complete set: Intro to C - Bill Buchanan
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
10.7.2 How <strong>to</strong> publish<br />
The class Country is the publisher.<br />
public delegate void changeHandler<br />
(object country, System.EventArgs e);<br />
public event changeHandler OnChange;<br />
public int Population<br />
{<br />
get{return this.population;}<br />
<strong>set</strong><br />
{<br />
this.population=value;<br />
if (OnChange!=null)<br />
OnChange(this,null);<br />
}<br />
}<br />
10.8 Benefits of using events<br />
We have created an application in which the user interface is able <strong>to</strong> respond <strong>to</strong><br />
changes in the data.<br />
Crucially the Country class has no connection with the user interface – even though<br />
the trigger action takes place inside the Country class we do not have <strong>to</strong> recompile<br />
the Country class <strong>to</strong> take account of changes <strong>to</strong> the user interface.<br />
duction <strong>to</strong> .NET<br />
<strong>Intro</strong><br />
Our interface will respond <strong>to</strong> changes even if third parties. Some other user who has<br />
no interest in our interface may make changes. We are moni<strong>to</strong>ring the objects “invisibly”.<br />
Agilent .NET Course: Module 10,page<br />
11