Edit

Share via


CodeDomSerializerBase.GetExpression Method

Definition

Returns an expression for the given object.

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

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

value
Object

The object for which to get an expression.

Returns

A CodeExpression representing value, or null if there is no existing expression for value.

Exceptions

manager is null.

Remarks

The GetExpression method returns an expression representing the given object. It can return null, indicating that no expression has been set that describes the object. Expressions are acquired in one of three ways:

To derive expressions through IReferenceService, the GetExpression method queries the reference service for a name for the given object. If the expression service returns a valid name, IReferenceService, the GetExpression method checks to see if there is a "." in the name. This indicates that the expression service found this object as the return value of a read-only property on another object. If there is a ".", GetExpression will split the reference into parts. The leftmost part is a name that will be evaluated with the GetInstance method. For each subsequent part, a property reference expression will be built. The final expression will then be returned.

If the object did not have an expression set, or if the object was not found in the reference service, GetExpression will return null, indicating there is no existing expression for the object.

Applies to

See also