<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.byte-welt.net/index.php?action=history&amp;feed=atom&amp;title=Event_und_Eventhandler</id>
	<title>Event und Eventhandler - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.byte-welt.net/index.php?action=history&amp;feed=atom&amp;title=Event_und_Eventhandler"/>
	<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=Event_und_Eventhandler&amp;action=history"/>
	<updated>2026-08-11T07:27:50Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Byte-Welt Wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=Event_und_Eventhandler&amp;diff=2460&amp;oldid=prev</id>
		<title>Jango am 12. Januar 2008 um 20:46 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=Event_und_Eventhandler&amp;diff=2460&amp;oldid=prev"/>
		<updated>2008-01-12T20:46:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 12. Januar 2008, 20:46 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Da die Frage nach Events auch schon im Forum aufgetaucht ist, denke ich, hier im Wiki ist es richtig aufgehoben.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Da die Frage nach Events auch schon im Forum aufgetaucht ist, denke ich, hier im Wiki ist es richtig aufgehoben.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;csharp&amp;gt;  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code=&lt;/ins&gt;csharp&amp;gt;  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  1:  namespace Lernen {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  1:  namespace Lernen {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  2:       &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  2:       &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l38&quot;&gt;Zeile 38:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 38:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;35:           &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;35:           &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;36:      }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;36:      }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;37:  }&amp;lt;/csharp&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;37:  }&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;code=&lt;/ins&gt;csharp&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bytewelt_wiki:diff:1.41:old-2459:rev-2460:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Jango</name></author>
	</entry>
	<entry>
		<id>https://wiki.byte-welt.net/index.php?title=Event_und_Eventhandler&amp;diff=2459&amp;oldid=prev</id>
		<title>Jango: Die Seite wurde neu angelegt: Da die Frage nach Events auch schon im Forum aufgetaucht ist, denke ich, hier im Wiki ist es richtig aufgehoben.&lt;br/&gt;&lt;br/&gt;  &lt;csharp&gt;   1:  namespace Lernen {  2:       ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.byte-welt.net/index.php?title=Event_und_Eventhandler&amp;diff=2459&amp;oldid=prev"/>
		<updated>2008-01-12T20:46:08Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: Da die Frage nach Events auch schon im Forum aufgetaucht ist, denke ich, hier im Wiki ist es richtig aufgehoben.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;  &amp;lt;csharp&amp;gt;   1:  namespace Lernen {  2:       ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Da die Frage nach Events auch schon im Forum aufgetaucht ist, denke ich, hier im Wiki ist es richtig aufgehoben.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt; &lt;br /&gt;
 1:  namespace Lernen {&lt;br /&gt;
 2:      &lt;br /&gt;
 3:      public delegate void Zeiger();  //Deklaration Delegate&lt;br /&gt;
 4:      &lt;br /&gt;
 5:      public class MyClass1 {&lt;br /&gt;
 6:          public event Zeiger Ereignis; //Deklaration Event&lt;br /&gt;
 7:          private int zahl;&lt;br /&gt;
 8:          public int Zahl {&lt;br /&gt;
 9:              get { return zahl; }&lt;br /&gt;
10:              set {&lt;br /&gt;
11:                  if (value != 0) {&lt;br /&gt;
12:                      zahl = value;&lt;br /&gt;
13:                  }&lt;br /&gt;
14:                  else {&lt;br /&gt;
15:                      Ereignis();&lt;br /&gt;
16:                  }&lt;br /&gt;
17:              }&lt;br /&gt;
18:          }&lt;br /&gt;
19:      }&lt;br /&gt;
20:  &lt;br /&gt;
21:  &lt;br /&gt;
22:      class MainClass {&lt;br /&gt;
23:          &lt;br /&gt;
24:          public static void Main(string[] args) {&lt;br /&gt;
25:              MyClass1 obj = new MyClass1();&lt;br /&gt;
26:              obj.Ereignis += new Zeiger(Handler);  //Event wird an Eventhandler gebunden&lt;br /&gt;
27:              obj.Zahl = 0;&lt;br /&gt;
28:           &lt;br /&gt;
29:          }&lt;br /&gt;
30:  &lt;br /&gt;
31:          public static void Handler() {&lt;br /&gt;
32:              Console.WriteLine(&amp;quot;Ungültiger Wert&amp;quot;);&lt;br /&gt;
33:          }&lt;br /&gt;
34:  &lt;br /&gt;
35:          &lt;br /&gt;
36:      }&lt;br /&gt;
37:  }&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Das einfache Beispiel zeigt uns, wie ein [[Delegate]] definiert wird (Zeile 3)und ein [[Event]] vom Typ eines [[Delegaten]] [[deklariert]] wird (Zeile 6).&amp;lt;br/&amp;gt;&lt;br /&gt;
Durch die [[Zuweisung]] eines nicht erlaubten Betrags (Zeile 27) an die Eigenschaft (Zeile 8), wird durch die &amp;#039;&amp;#039;[[if]]&amp;#039;&amp;#039;-Anweisung das [[Event]] ausgelöst.&lt;br /&gt;
Der [[Eventhandler]] kann aber jede parameterlose [[Methode]] sein, die vom [[Rückgabetyp]] her [[void]] ist. Wir müssen also das [[Event]] an eine [[Methode]] &amp;#039;binden&amp;#039; (es ist nicht vorgeschrieben, dass ein [[Ereignis]] nur einen [[Eventhandler]] bedient). Das geschieht in Zeile 26 mittels &amp;#039;+=&amp;#039; [[Operator]].&lt;br /&gt;
Nach der [[Zuweisung]] eines falschen Wertes wird nun das [[Ereignis]] ausgelöst, welches vom [[Eventhandler]] in Zeile 31 aufgenommen wird. Das Resultat ist die Ausführung des [[Codes]] der [[Methode]] (in unserem Fall der [[Eventhandler]]) Handler. Es wird an der [[Konsole]] &amp;quot;Ungültiger Wert&amp;quot; ausgegeben.&lt;br /&gt;
&lt;br /&gt;
--[[Benutzer:Jango|Jango]] 21:46, 12. Jan 2008 (CET)&lt;br /&gt;
&lt;br /&gt;
[[Kategorie:CSharp]]&lt;/div&gt;</summary>
		<author><name>Jango</name></author>
	</entry>
</feed>