running unknow methods

Hi,
i want to run unknow method with params inside of class.
something like this
public class class1()
{
function function1;
public class1(function paFunction)
{
function1 = paFunction;
}
public run(string param)
{
function1(param);
}
}
-
i want to call this function
pubic void setText(sting paText)
{
text = paText;
}
-
class1 a = new class1(setText);
a.run("hi world");
-
this is only idea how it could to work, but of course it doesn`t, is this possible in C# to do, and how?
thank you,
Gibic
[631 byte] By [gibic] at [2007-12-16]
# 1

Yes, you can achieve this by using Delegates feature of C#. The example at this link from MSDN teaches you how to define and use delegates in C#

[ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkdelegatestutorial.asp ]

Regards,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com

SaurabhNandu at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...