Back to notes -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    A Messenger class and a Message delegate.Lecture 6 - slide 8 : 20
Program 1
using System;

public delegate void Message(string txt);  
public class Messenger{           
  private string sender;
  private Message message;                 

  public Messenger(string sender){
   this.sender = sender;
   message = null;

  public Messenger(string sender, Message aMessage){  
   this.sender = sender;
   message = aMessage;

  public void DoSend(){  
   message("Message from " + sender);
A delegate type named Message.
Can contain void methods that take a string parameter.
A simple class that encapsulates a sender
string and a Message delegate.
The encapsulated delegate
Activation of the encapsulated delegate