Uredi

Deli z drugimi prek


CodeDomSerializerBase.DeserializeExpression Method

Definition

Deserializes the given expression into an in-memory object.

protected:
 System::Object ^ DeserializeExpression(System::ComponentModel::Design::Serialization::IDesignerSerializationManager ^ manager, System::String ^ name, System::CodeDom::CodeExpression ^ expression);
protected object DeserializeExpression (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string name, System.CodeDom.CodeExpression expression);
protected object? DeserializeExpression (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string? name, System.CodeDom.CodeExpression? expression);
member this.DeserializeExpression : System.ComponentModel.Design.Serialization.IDesignerSerializationManager * string * System.CodeDom.CodeExpression -> obj
Protected Function DeserializeExpression (manager As IDesignerSerializationManager, name As String, expression As CodeExpression) As Object

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

name
String

The name of the object that results from the expression. Can be null if there is no need to name the object.

expression
CodeExpression

The CodeExpression to interpret.

Returns

An object resulting from interpretation of expression.

Remarks

This is a helper method that derived classes can call to deserialize an expression. It deserializes the statement by interpreting and executing the CodeDOM expression specified by the expression parameter, and then returns the results. If an object needs to be created as a result of this expression, it will be given the name specified by the name parameter. The name can be null if there is no need to name the object. The following table describes how specific expressions are handled.

Expression Behavior
CodeThisReferenceExpression This expression represents this or Me. To locate the object that is associated with this expression, the DeserializeExpression method will look in the context stack for a RootContext. This object contains the root object of the graph and the expression that represents it. If the object is present and the expression matches, the root object will be returned. An error is reported if an instance cannot be located.
CodeFieldReferenceExpression If the target of the field reference evaluates to the root object, the GetInstance method of the manager parameter will be used to retrieve the object instance based on name. Otherwise, standard reflection is used against the target object to locate the requested field. An error is reported if the field cannot be located.
CodeVariableReferenceExpression The GetInstance method of the manager parameter is used to locate the instance representing the given variable name. An error is reported if an instance cannot be located.

DeserializeExpression continues to interpret expressions until they are completely resolved to an object, or until it can no longer simplify the expression. In this case, DeserializeExpression will return a CodeExpression that contains the most simplified expression. The following expressions are not supported:

Applies to

See also