RazorEngine


Impromptu

Defined in RazorEngine.dll.

Main API

Static members

Static memberDescription
ActLike(...)
Signature: (originalDynamic:obj * otherInterfaces:Type []) -> 'TInterface
Type parameters: 'TInterface

Extension Method that Wraps an existing object with an Explicit interface definition

Returns:

ActLike(...)
Signature: (originalDynamic:obj * otherInterfaces:Type []) -> obj

Extension Method that Wraps an existing object with an Interface of what it is implicitly assigned to.

Returns:

ActLikeProperties(...)
Signature: (originalDynamic:obj * propertySpec:IDictionary<string,Type>) -> obj

Makes static methods for the passed in property spec, designed to be used with old api's that reflect properties.

Returns:

AllActLike(...)
Signature: (originalDynamic:IEnumerable<obj> * otherInterfaces:Type []) -> IEnumerable<'TInterface>
Type parameters: 'TInterface

Chainable Linq to Objects Method, allows you to wrap a list of objects with an Explict interface defintion

Returns:

AllCallActLike(...)
Signature: (originalDynamic:IEnumerable<obj> * caller:obj * otherInterfaces:Type []) -> IEnumerable<'TInterface>
Type parameters: 'TInterface

Chainable Linq to Objects Method, allows you to wrap a list of objects, and preserve method permissions with a caller, with an Explict interface defintion

Returns:

CallActLike(...)
Signature: (caller:obj * originalDynamic:obj * otherInterfaces:Type []) -> 'TInterface
Type parameters: 'TInterface

This Extension method is called off the calling context to perserve permissions with the object wrapped with an explicit interface definition.

Returns:

CallDynamicActLike(...)
Signature: (caller:obj * originalDynamic:obj * otherInterfaces:Type []) -> obj

This Extension method is called off the calling context to perserve permissions with the object wrapped with an explicit interface definition.

Returns:

CoerceToDelegate(...)
Signature: (invokeableObject:obj * delegateType:Type) -> obj

Coerce to delegate.

Returns:

CreateCallSite(...)
Signature: (delegateType:Type * binder:CallSiteBinder * name:String_OR_InvokeMemberName * context:Type * argNames:string [] * staticContext:bool * isEvent:bool) -> CallSite
Impromptu.CreateCallSite``1

Creates a cached call site at runtime.

Returns: The CallSite

Remarks

Advanced usage only for serious custom dynamic invocation.

CreateCallSite(...)
Signature: (binder:CallSiteBinder * name:String_OR_InvokeMemberName * context:Type * argNames:string [] * staticContext:bool * isEvent:bool) -> CallSite<'T>
Type parameters: 'T
/// Impromptu.CreateCallSite

Creates the call site.

Returns:

DynamicActLike(...)
Signature: (originalDynamic:obj * otherInterfaces:Type []) -> obj

Static Method that wraps an existing dyanmic object with a explicit interface type

Returns:

FastDynamicInvoke(del, args)
Signature: (del:Delegate * args:obj []) -> obj

FastDynamicInvoke extension method. Runs up to runs up to 20x faster than Delegate.DynamicInvoke .

Returns:

GenericDelegateType(...)
Signature: (paramCount:int * returnVoid:bool) -> Type

Given a generic parameter count and whether it returns void or not gives type of Action or Func

Returns: Type of Action or Func

GetMemberNames(target, dynamicOnly)
Signature: (target:obj * dynamicOnly:bool) -> IEnumerable<string>

Gets the member names of properties. Not all IDynamicMetaObjectProvider have support for this.

Returns:

Invoke(target, args)
Signature: (target:obj * args:obj []) -> obj

Invokes the specified target using the DLR;

Returns:

Invoke(callSite, target, args)
Signature: (callSite:CallSite * target:obj * args:obj []) -> obj

Dynamically invokes a method determined by the CallSite binder and be given an appropriate delegate type

Returns:

Remarks

Advanced use only. Use this method for serious custom invocation, otherwise there are other convenience methods such as Impromptu.InvokeMember, Impromptu.InvokeGet, Impromptu.InvokeSet and Impromptu.InvokeMemberAction

InvokeAction(target, args)
Signature: (target:obj * args:obj []) -> unit

Invokes the action using the DLR

InvokeAddAssign(target, name, value)
Signature: (target:obj * name:string * value:obj) -> unit

Invokes add assign with correct behavior for events.

InvokeAddAssignMember(...)
Signature: (target:obj * name:string * value:obj) -> unit

Invokes add assign with correct behavior for events.

InvokeBinaryOperator(...)
Signature: (leftArg:obj * op:ExpressionType * rightArg:obj) -> obj

Invokes the binary operator.

Returns:

InvokeCallSite(callSite, target, args)
Signature: (callSite:CallSite * target:obj * args:obj []) -> obj

Dynamically invokes a method determined by the CallSite binder and be given an appropriate delegate type

Returns:

Remarks

Advanced use only. Use this method for serious custom invocation, otherwise there are other convenience methods such as Impromptu.InvokeMember, Impromptu.InvokeGet, Impromptu.InvokeSet and Impromptu.InvokeMemberAction

InvokeConstructor(type, args)
Signature: (type:Type * args:obj []) -> obj

Invokes the constuctor.

Returns:

InvokeConstuctor(type, args)
Signature: (type:Type * args:obj []) -> obj

(Obsolete)Invokes the constructor. misspelling

Returns:

InvokeConvert(target, type, explicit)
Signature: (target:obj * type:Type * explicit:bool) -> obj

Invokes convert using the DLR.

Returns:

InvokeGet(target, name)
Signature: (target:obj * name:string) -> obj

Dynamically Invokes a get member using the DLR.

Returns: The result.

InvokeGetIndex(target, indexes)
Signature: (target:obj * indexes:obj []) -> obj

Dynamically Invokes indexer using the DLR.

Returns:

InvokeIsEvent(target, name)
Signature: (target:obj * name:string) -> bool

Determines whether the specified name on target is event. This allows you to know whether to InvokeMemberAction add_{name} or a combo of {invokeget, +=, invokeset} and the corresponding remove_{name} or a combon of {invokeget, -=, invokeset}

Returns: true if the specified target is event; otherwise, false.

InvokeMember(target, name, args)
Signature: (target:obj * name:String_OR_InvokeMemberName * args:obj []) -> obj

Dynamically Invokes a member method using the DLR

Returns: The result

InvokeMemberAction(target, name, args)
Signature: (target:obj * name:String_OR_InvokeMemberName * args:obj []) -> unit

Dynamically Invokes a member method which returns void using the DLR

InvokeSet(target, name, value)
Signature: (target:obj * name:string * value:obj) -> obj

Dynamically Invokes a set member using the DLR.

Remarks

if you call a static property off a type with a static context the csharp dlr binder won't do it, so this method reverts to reflection

InvokeSetIndex(target, indexesThenValue)
Signature: (target:obj * indexesThenValue:obj []) -> obj

Invokes setindex.

InvokeSetValueOnIndexes(...)
Signature: (target:obj * value:obj * indexes:obj []) -> obj

Convenience version of InvokeSetIndex that separates value and indexes.

Returns:

InvokeSubtractAssign(...)
Signature: (target:obj * name:string * value:obj) -> unit

Invokes subtract assign with correct behavior for events.

InvokeSubtractAssignMember(...)
Signature: (target:obj * name:string * value:obj) -> unit

Invokes subtract assign with correct behavior for events.

InvokeUnaryOperator(op, arg)
Signature: (op:ExpressionType * arg:obj) -> obj

Invokes the unary opartor.

Returns:

UndoActLike(proxiedObject)
Signature: proxiedObject:obj -> obj

Unwraps the act like proxy (if wrapped).

Returns:

Fork me on GitHub