SerializeResource Method

CodeDomSerializerBase.SerializeResource Method (IDesignerSerializationManager, String, Object)

 

Serializes the given object into a resource bundle using the given resource name.

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

protected void SerializeResource(
	IDesignerSerializationManager manager,
	string resourceName,
	object value
)

Parameters

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

The IDesignerSerializationManager to use for serialization.

resourceName
Type: System.String

The name of the resource bundle into which value will be serialized.

value
Type: System.Object

The object to serialize.

The SerializeResource method is a helper method that serializes a value to a resource bundle under the given name. The culture that the resource is written to is determined by searching the serialization manager’s Properties collection for a property called ResourceCulture. If this property exists, resources will be written to that culture. Otherwise, resources will be written to the invariant culture. The value parameter must be serializable.

SerializeResource requires an IResourceService to obtain a ResourceWriter to write resources for the correct culture. If this service is not available, SerializeResource will instead build a binary object in code that represents the resource.

Notes to Callers:

ResourceCulture is a read-write property that is accessed through the serialization manager’s Properties collection. The SerializeResource method never changes the value of this property; it merely reads it to identify the culture to which it will write. The property is set during deserialization as resources are parsed and loaded.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft