CodeDomSerializerBase.DeserializeExpression Method (IDesignerSerializationManager, String, CodeExpression)

 

Deserializes the given expression into an in-memory object.

Namespace:   System.ComponentModel.Design.Serialization
Assembly:  System.Design (in System.Design.dll)

protected object DeserializeExpression(
	IDesignerSerializationManager manager,
	string name,
	CodeExpression expression
)

Parameters

manager
Type: System.ComponentModel.Design.Serialization.IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

name
Type: System.String

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

expression
Type: System.CodeDom.CodeExpression

The CodeExpression to interpret.

Return Value

Type: System.Object

An object resulting from interpretation of expression.

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:

.NET Framework
Available since 2.0
Return to top
Show: