C# Class Monobjc.Block

Managed implementation of the blocks as defined in the Language Specification for Blocks[1]. Even if the implementation strictly follows the Block Implementation Specification[2], it is restricted to global block for the moment.

The block bridging allow a delegate function or action to be marshalled as a native block. Its implementation points to a proxy invoker that will forward the native block invocation to the delegate function or action.

Currently, any delegate can be passed to create a block. For example:

Delegate Equivalent block signature Action void (^)() Action{T1,T2,T3} void (^)(T1, T2, T3) Func{TResult} TResult (^)() Func{T1,T2,TResult} TResult (^)(T1, T2)

[1] Language Specification for Blocks (http://clang.llvm.org/docs/BlockLanguageSpec.html)

[2] Block Implementation Specification (http://clang.llvm.org/docs/Block-ABI-Apple.html)

Inheritance: IDisposable
Show file Open project: Monobjc/monobjc

Public Methods

Method Description
Create ( Delegate @delegate ) : Block

Create a block around the specified delegate.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

ToString ( ) : string

Returns a String that represents this instance.

Protected Methods

Method Description
Block ( Delegate invoker ) : System

Initializes a new instance of the Block class.

Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

Private Methods

Method Description
CreateBlock ( Object thunk, Object invoker, IntPtr function ) : IntPtr
DestroyBlock ( IntPtr layout ) : void

Method Details

Block() protected method

Initializes a new instance of the Block class.
protected Block ( Delegate invoker ) : System
invoker System.Delegate The invoker.
return System

Create() public static method

Create a block around the specified delegate.
public static Create ( Delegate @delegate ) : Block
@delegate System.Delegate
return Block

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Dispose() protected method

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

ToString() public method

Returns a String that represents this instance.
public ToString ( ) : string
return string