Table of Contents

Class ExpressionCompiler

Namespace
Moq
Assembly
Moq.dll

An ExpressionCompiler compiles LINQ expression trees (Expression) to delegates. Whenever Moq needs to compile an expression tree, it uses the instance set up by Instance.

public abstract class ExpressionCompiler
Inheritance
ExpressionCompiler
Inherited Members

Constructors

ExpressionCompiler()

Initializes a new instance of the ExpressionCompiler class.

protected ExpressionCompiler()

Properties

Default

The default ExpressionCompiler instance, which simply delegates to the framework's Compile().

public static ExpressionCompiler Default { get; }

Property Value

ExpressionCompiler

Instance

Gets or sets the ExpressionCompiler instance that Moq uses to compile Expression (LINQ expression trees). Defaults to Default.

public static ExpressionCompiler Instance { get; set; }

Property Value

ExpressionCompiler

Methods

Compile(LambdaExpression)

Compiles the specified LINQ expression tree.

public abstract Delegate Compile(LambdaExpression expression)

Parameters

expression LambdaExpression

The LINQ expression tree that should be compiled.

Returns

Delegate

Compile<TDelegate>(Expression<TDelegate>)

Compiles the specified LINQ expression tree.

public abstract TDelegate Compile<TDelegate>(Expression<TDelegate> expression) where TDelegate : Delegate

Parameters

expression Expression<TDelegate>

The LINQ expression tree that should be compiled.

Returns

TDelegate

Type Parameters

TDelegate

The type of delegate to which the expression will be compiled.