Επεξεργασία

Κοινή χρήση μέσω


CollectionCodeDomSerializer.Serialize Method

Definition

Serializes the given collection into a CodeDOM object.

public:
 override System::Object ^ Serialize(System::ComponentModel::Design::Serialization::IDesignerSerializationManager ^ manager, System::Object ^ value);
public override object Serialize (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, object value);
public override object? Serialize (System.ComponentModel.Design.Serialization.IDesignerSerializationManager manager, object value);
override this.Serialize : System.ComponentModel.Design.Serialization.IDesignerSerializationManager * obj -> obj
Public Overrides Function Serialize (manager As IDesignerSerializationManager, value As Object) As Object

Parameters

manager
IDesignerSerializationManager

The IDesignerSerializationManager to use during serialization.

value
Object

The object to serialize.

Returns

A CodeDOM object representing value.

Exceptions

manager or value is null.

Remarks

Collections are serialized as follows:

  1. If the collection is an array, the array is written.

    1. If the collection has an AddRange method, it will be called and provided with an array.

    2. If the collection has an Add method, it will be called repeatedly until all items in the collection are written.

  2. If the collection is an IList, the Serialize method will cast the collection to an IList and add through that interface.

    1. If the collection has no Add method, but is marked with DesignerSerializationVisibility.Content, Serialize will enumerate the collection and serialize each element.

Applies to

See also