ExpressionBuilder.EvaluateExpression Method

Definition

When overridden in a derived class, returns an object that represents an evaluated expression.

public virtual object EvaluateExpression (object target, System.Web.UI.BoundPropertyEntry entry, object parsedData, System.Web.Compilation.ExpressionBuilderContext context);

Parameters

target
Object

The object containing the expression.

entry
BoundPropertyEntry

The object that represents information about the property bound to by the expression.

parsedData
Object

The object containing parsed data as returned by ParseExpression(String, Type, ExpressionBuilderContext).

context
ExpressionBuilderContext

Contextual information for the evaluation of the expression.

Returns

An object that represents the evaluated expression; otherwise, null if the inheritor does not implement EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext).

Examples

The following code example demonstrates how to use the overridden EvaluateExpression method to return an evaluated expression.

public override object EvaluateExpression(object target, BoundPropertyEntry entry, 
object parsedData, ExpressionBuilderContext context)
{
    return GetEvalData(entry.Expression, target.GetType(), entry.Name);
}

Remarks

If you want your ExpressionBuilder object to be active on a page that supports the no-compile feature, you can override the EvaluateExpression method and the SupportsEvaluate property. The EvaluateExpression method should return the evaluation of the current expression.

Notes to Inheritors

If you override the EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext) method, you must also override the SupportsEvaluate property.

Applies to

제품 버전
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1