How to call a delegate held in a Variant array?

Gary Willoughby dev at nomad.so
Tue Sep 10 13:09:33 PDT 2013


How to call a delegate held in a Variant array? I'm toying with 
some dynamic delegate code and wondered if i put a delegate in a 
Variant how would i call it?

class C
{
	private Variant[string] _methods;

	public void addMethod(T)(string name, T func)
	{
		this._methods[name] = func;
	}
}

auto obj = new C();

obj.addMethod("test", delegate(){
	return 34;
});

Now, how do i call the delegate held in 'this._methods["test"]'?


More information about the Digitalmars-d-learn mailing list