So if you put them together, you end up with very useful conclusions.... Such as the classic Observer Pattern I have been dealing with a lot lately.
1: <PRE lang=cs>private int m_MyValue;
2:
3: public int MyValue
4: { 5: get
6: { 7: return this.m_MyValue;
8: }
9: set
10: { 11: if ((this.m_MyValue != value))
12: { 13: int oldValue = this.m_MyValue;
14: this.m_MyValue = value;
15: this.OnMyValueChanged(new MyValueChangedEventArgs(oldValue,
16: this.m_MyValue));
17: }
18: }
19: }
20:
21: public event MyValueChangedEventHandler MyValueChanged;
22:
23: protected virtual void OnMyValueChanged(MyValueChangedEventArgs e)
24: { 25: if ((this.MyValueChanged != null))
26: { 27: this.MyValueChanged(this, e);
28: }
29: }
30:
31: public delegate void MyValueChangedEventHandler(object sender,
32: MyValueChangedEventArgs e);
33:
34: public class MyValueChangedEventArgs : System.EventArgs
35: { 36: private int m_OldValue;
37:
38: private int m_NewValue;
39:
40: public MyValueChangedEventArgs(int OldValue, int NewValue)
41: { 42: this.m_OldValue = OldValue;
43: this.m_NewValue = NewValue;
44: }
45:
46: public virtual int OldValue
47: { 48: get
49: { 50: return this.m_OldValue;
51: }
52: }
53:
54: public virtual int NewValue
55: { 56: get
57: { 58: return this.m_NewValue;
59: }
60: }
61: }</PRE>