แก้ไข

แชร์ผ่าน


CodeDomSerializerBase.SerializeResource Method

Definition

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

protected:
 void SerializeResource(System::ComponentModel::Design::Serialization::IDesignerSerializationManager ^ manager, System::String ^ resourceName, System::Object ^ value);
protected void SerializeResource (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string resourceName, object value);
protected void SerializeResource (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, string resourceName, object? value);
member this.SerializeResource : System.ComponentModel.Design.Serialization.IDesignerSerializationManager * string * obj -> unit
Protected Sub SerializeResource (manager As IDesignerSerializationManager, resourceName As String, value As Object)

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use for serialization.

resourceName
String

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

value
Object

The object to serialize.

Remarks

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(IDesignerSerializationManager, String, Object) 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.

Applies to

See also