แก้ไข

แชร์ผ่าน


ExpressionBuilder.EvaluateExpression Method

Definition

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

public:
 virtual System::Object ^ EvaluateExpression(System::Object ^ target, System::Web::UI::BoundPropertyEntry ^ entry, System::Object ^ parsedData, System::Web::Compilation::ExpressionBuilderContext ^ context);
public virtual object EvaluateExpression (object target, System.Web.UI.BoundPropertyEntry entry, object parsedData, System.Web.Compilation.ExpressionBuilderContext context);
abstract member EvaluateExpression : obj * System.Web.UI.BoundPropertyEntry * obj * System.Web.Compilation.ExpressionBuilderContext -> obj
override this.EvaluateExpression : obj * System.Web.UI.BoundPropertyEntry * obj * System.Web.Compilation.ExpressionBuilderContext -> obj
Public Overridable Function EvaluateExpression (target As Object, entry As BoundPropertyEntry, parsedData As Object, context As ExpressionBuilderContext) As Object

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);
}
Public Overrides Function EvaluateExpression(ByVal target As Object, _
   ByVal entry As BoundPropertyEntry, ByVal parsedData As Object, _
   ByVal context As ExpressionBuilderContext) As Object
    Return GetEvalData(entry.Expression, target.GetType(), entry.Name)
End Function

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