Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Serializes an object into an expression.
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. |
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
The IDesignerSerializationManager to use for serialization.
The object to serialize.
A CodeExpression containing value
as a serialized expression.
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.
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
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
The IDesignerSerializationManager to use for serialization.
The object to serialize.
true
to serialize into the invariant culture; otherwise, false
.
A CodeExpression containing value
as a serialized expression.
manager
is null
.
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.
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in