== Quote from Heromyth ([email protected])'s article
> == Quote from Philippe Sigaud ([email protected])'s article
> > I suppose you do *not*want the commented line?
> I want to convert a delegate type define in C# to D's, as such:
> public delegate void AsynchronousAction<T>(T argument, AsyncContinuation
> asyncContinuation);
> public static void ForEachItemSequentially<T>(IEnumerable<T> items,
> AsyncContinuation asyncContinuation, AsynchronousAction<T> action)
> {
> ......
> }
Woo, I got it.
template AsynchronousAction(T)
{
alias void delegate(T argument) AsynchronousAction;
}
public class TestC
{
int b = 3;
//void test(T)(void delegate(T argument) func )
void test(T)(AsynchronousAction!(T) func )
{
static if(is(T == string))
func("It's me");
}
this(int x)
{
b = x;
}
}