Show / Hide Table of Contents

Class CallbackFunction

This class wraps a CLR function

Inheritance
System.Object
RefIdObject
CallbackFunction
Inherited Members
RefIdObject.ReferenceID
RefIdObject.FormatTypeString(String)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public sealed class CallbackFunction : RefIdObject

Constructors

CallbackFunction(Func<ScriptExecutionContext, CallbackArguments, DynValue>, String)

Initializes a new instance of the CallbackFunction class.

Declaration
public CallbackFunction(Func<ScriptExecutionContext, CallbackArguments, DynValue> callBack, string name = null)
Parameters
Func<ScriptExecutionContext, CallbackArguments, DynValue> callBack

The callback function to be called.

System.String name

The callback name, used in stacktraces, debugger, etc..

Properties

AdditionalData

Gets or sets an object used as additional data to the callback function (available in the execution context).

Declaration
public object AdditionalData { get; set; }
Property Value
System.Object

ClrCallback

Gets the call back.

Declaration
public Func<ScriptExecutionContext, CallbackArguments, DynValue> ClrCallback { get; }
Property Value
Func<ScriptExecutionContext, CallbackArguments, DynValue>

The call back.

DefaultAccessMode

Gets or sets the default access mode used when marshalling delegates

Declaration
public static InteropAccessMode DefaultAccessMode { get; set; }
Property Value
InteropAccessMode

The default access mode. Default, HideMembers and BackgroundOptimized are NOT supported.

Exceptions
System.ArgumentException

Default, HideMembers and BackgroundOptimized are NOT supported.

Name

Gets the name of the function

Declaration
public string Name { get; }
Property Value
System.String

Methods

CheckCallbackSignature(MethodInfo, Boolean)

Checks the callback signature of a method is compatible for callbacks

Declaration
public static bool CheckCallbackSignature(MethodInfo mi, bool requirePublicVisibility)
Parameters
System.Reflection.MethodInfo mi

System.Boolean requirePublicVisibility

Returns
System.Boolean

FromDelegate(Script, Delegate, InteropAccessMode)

Creates a CallbackFunction from a delegate.

Declaration
public static CallbackFunction FromDelegate(Script script, Delegate del, InteropAccessMode accessMode = InteropAccessMode.Default)
Parameters
Script script

The script.

Delegate del

The delegate.

InteropAccessMode accessMode

The access mode.

Returns
CallbackFunction

FromMethodInfo(Script, MethodInfo, Object, InteropAccessMode)

Creates a CallbackFunction from a MethodInfo relative to a function.

Declaration
public static CallbackFunction FromMethodInfo(Script script, MethodInfo mi, object obj = null, InteropAccessMode accessMode = InteropAccessMode.Default)
Parameters
Script script

The script.

System.Reflection.MethodInfo mi

The MethodInfo object.

System.Object obj

The object to which the function applies, or null for static methods.

InteropAccessMode accessMode

The access mode.

Returns
CallbackFunction

Exceptions
System.ArgumentException

The method is not static.

Invoke(ScriptExecutionContext, IList<DynValue>, Boolean)

Invokes the callback function

Declaration
public DynValue Invoke(ScriptExecutionContext executionContext, IList<DynValue> args, bool isMethodCall = false)
Parameters
ScriptExecutionContext executionContext

The execution context.

IList<DynValue> args

The arguments.

System.Boolean isMethodCall

if set to true this is a method call.

Returns
DynValue

Back to top Built by Itinero, MIT licensed.