CodeDomSerializerBase::SerializeToResourceExpression Method (IDesignerSerializationManager^, Object^)
Serializes the given object into an expression.
Assembly: System.Design (in System.Design.dll)
protected: CodeExpression^ SerializeToResourceExpression( IDesignerSerializationManager^ manager, Object^ value )
Parameters
- manager
-
Type:
System.ComponentModel.Design.Serialization::IDesignerSerializationManager^
The IDesignerSerializationManager to use for serialization.
- value
-
Type:
System::Object^
The object to serialize.
Return Value
Type: System.CodeDom::CodeExpression^A CodeExpression containing value as a serialized expression.
| Exception | Condition |
|---|---|
| ArgumentNullException | manager is null. |
The SerializeToResourceExpression method is a helper method that serializes a value to a resource expression. This is in contrast to the SerializeResource method, which writes a value to a resource binary object. SerializeToResourceExpression goes one step further and returns an expression that can be used to recover the resource. For example, the return value might be "rm.GetValue("SomeBitmap");". The name of the resource is calculated from the ExpressionContext, if one can be found on the context stack.
The SerializeToResourceExpression method will look on the ContextStack for the following objects:
CodeStatementCollection—a collection of statements to add a resource manager to, if one needs to be declared.
RootContext—the root expression, which is needed to create a resource manager.
ExpressionContext—used to fabricate a name for the resource and to decide what type of resource manager call to make.
Available since 2.0