G
Guest
Hi.
I'm looking for a way to make a delegate point to a constructor.
I'm not too sure i'm explaining it right,so here's a sample code to
demonstrate.
-----
using System.Windows.Forms;
class xyz
{
public delegate Form MyDelegate (string input);
public static void func (MyDelegate x)
{
Form y = x("p");
}
}
class abc : Form
{
public abc (string title) {...}
....
}
-----
Now i would want to make the xyz.func() create a new "abc".
both the "MyDelegate" and the "abc" constructor have the same return value
and the same parameters,so theoretically there should be a way.
Hopefully i'm clear enough for someone...
Thank you
I'm looking for a way to make a delegate point to a constructor.
I'm not too sure i'm explaining it right,so here's a sample code to
demonstrate.
-----
using System.Windows.Forms;
class xyz
{
public delegate Form MyDelegate (string input);
public static void func (MyDelegate x)
{
Form y = x("p");
}
}
class abc : Form
{
public abc (string title) {...}
....
}
-----
Now i would want to make the xyz.func() create a new "abc".
both the "MyDelegate" and the "abc" constructor have the same return value
and the same parameters,so theoretically there should be a way.
Hopefully i'm clear enough for someone...
Thank you