Monobjc.ObjectiveCRuntime.CreateBlock C# (CSharp) Method

CreateBlock() public static method

Creates a block with the given delegate.
public static CreateBlock ( Delegate @delegate ) : Block
@delegate System.Delegate
return Block
		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);
		}
	}