public static Block CreateBlock (Delegate @delegate)
{
Type delegateType = @delegate.GetType ();
Type blockProxyType;
// Search for an existing block proxy
lock (BLOCK_TYPES) {
if (!BLOCK_TYPES.TryGetValue (delegateType, out blockProxyType)) {
blockProxyType = BlockGenerator.DefineBlockProxy (delegateType);
BLOCK_TYPES [delegateType] = blockProxyType;
}
}
// Create a new instance of the block proxy
return (Block)Activator.CreateInstance (blockProxyType, @delegate);
}
}