Skip to content

Instantly share code, notes, and snippets.

@zendrulat
Created October 1, 2014 14:21
Show Gist options
  • Save zendrulat/5d454e25f5662891aab0 to your computer and use it in GitHub Desktop.
Save zendrulat/5d454e25f5662891aab0 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace present2
{
//First step!!!!!
//declaring a delegate
delegate void del();
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//this.button1.MouseClick += this.MultiHandler;
}
// Second step!!!!!!!
// make the class for the methods
class methods
{
// Third step!!!!!!!
//make methods
public string FirstMethod(string j)//method one
{
string FrstDel = "first delegate";
return FrstDel;
}//end FirstMethod
}//end methods class
private void button1_Click(object sender, EventArgs e)
{
methods mt = new methods();
//sixth step!!!!!!
//map the delegate to the methods
FrstDel = "here";
del d = mt.FirstMethod(FrstDel);
//call the delegate->method
lblAnswer1.Text = cstr(d());
}
}//end of calldelegates class
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment