I'm trying to pass the name of a method from one class to another class, so the other class can "subscribe" her to an event that the first class is not aware of. Let's say I've got those classes:
class1
{
public void method1(string msg)
{
//does something with msg
}
public void i_make_a_class2()
{
class2 bob = new class2(method1);
}
}
class2
{
delegate void deleg(string msg);
deleg deleg1;
public class2(string fct)
{
// What I'm trying to do would go there with "fct" converted to function signature
deleg1 = new deleg(fct);
// Rest of the class constructor...
}
private void method2()
{
deleg1(im_a_String);
}
}