Uredi

Deli z drugimi prek


CodeDomSerializerBase.SerializeToResourceExpression Method

Definition

Serializes an object into an expression.

Overloads

SerializeToResourceExpression(IDesignerSerializationManager, Object)

Serializes the given object into an expression.

SerializeToResourceExpression(IDesignerSerializationManager, Object, Boolean)

Serializes the given object into an expression appropriate for the invariant culture.

SerializeToResourceExpression(IDesignerSerializationManager, Object)

Serializes the given object into an expression.

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

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

value
Object

The object to serialize.

Returns

A CodeExpression containing value as a serialized expression.

Exceptions

manager is null.

Remarks

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.

See also

Applies to

SerializeToResourceExpression(IDesignerSerializationManager, Object, Boolean)

Serializes the given object into an expression appropriate for the invariant culture.

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

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

value
Object

The object to serialize.

ensureInvariant
Boolean

true to serialize into the invariant culture; otherwise, false.

Returns

A CodeExpression containing value as a serialized expression.

Exceptions

manager is null.

Remarks

If the ensureInvariant parameter is true, the SerializeToResourceExpression method will also write the resource value into the invariant culture's resource file if the current ResourceCulture is not the invariant culture.

See also

Applies to