IDesignerSerializationManager Interface
Provides an interface that can manage design-time serialization.
Assembly: System (in System.dll)
The IDesignerSerializationManager type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Context | Gets a stack-based, user-defined storage area that is useful for communication between serializers. |
![]() | Properties | Indicates custom properties that can be serializable with available serializers. |
| Name | Description | |
|---|---|---|
![]() | AddSerializationProvider | Adds the specified serialization provider to the serialization manager. |
![]() | CreateInstance | Creates an instance of the specified type and adds it to a collection of named instances. |
![]() | GetInstance | Gets an instance of a created object of the specified name, or null if that object does not exist. |
![]() | GetName | Gets the name of the specified object, or null if the object has no name. |
![]() | GetSerializer | Gets a serializer of the requested type for the specified object type. |
![]() | GetService | Gets the service object of the specified type. (Inherited from IServiceProvider.) |
![]() | GetType | Gets a type of the specified name. |
![]() | RemoveSerializationProvider | Removes a custom serialization provider from the serialization manager. |
![]() | ReportError | Reports an error in serialization. |
![]() | SetName | Sets the name of the specified existing object. |
| Name | Description | |
|---|---|---|
![]() | ResolveName | Occurs when GetName cannot locate the specified name in the serialization manager's name table. |
![]() | SerializationComplete | Occurs when serialization is complete. |
A designer can utilize IDesignerSerializationManager to access services useful to managing design-time serialization processes. For example, a class that implements the designer serialization manager can use this interface to create objects, look up types, identify objects, and customize the serialization of particular types.
The following example illustrates how to use IDesignerSerializationManager to serialize and deserialize Code DOM statements.
using System; using System.CodeDom; using System.ComponentModel; using System.ComponentModel.Design; using System.ComponentModel.Design.Serialization; using System.Drawing; using System.Windows.Forms; namespace CodeDomSerializerSample { internal class MyCodeDomSerializer : CodeDomSerializer { public override object Deserialize(IDesignerSerializationManager manager, object codeObject) { // This is how we associate the component with the serializer. CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager. GetSerializer(typeof(MyComponent).BaseType, typeof(CodeDomSerializer)); /* This is the simplest case, in which the class just calls the base class to do the work. */ return baseClassSerializer.Deserialize(manager, codeObject); } public override object Serialize(IDesignerSerializationManager manager, object value) { /* Associate the component with the serializer in the same manner as with Deserialize */ CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager. GetSerializer(typeof(MyComponent).BaseType, typeof(CodeDomSerializer)); object codeObject = baseClassSerializer.Serialize(manager, value); /* Anything could be in the codeObject. This sample operates on a CodeStatementCollection. */ if (codeObject is CodeStatementCollection) { CodeStatementCollection statements = (CodeStatementCollection)codeObject; // The code statement collection is valid, so add a comment. string commentText = "This comment was added to this object by a custom serializer."; CodeCommentStatement comment = new CodeCommentStatement(commentText); statements.Insert(0, comment); } return codeObject; } } [DesignerSerializer(typeof(MyCodeDomSerializer), typeof(CodeDomSerializer))] public class MyComponent : Component { private string localProperty = "Component Property Value"; public string LocalProperty { get { return localProperty; } set { localProperty = value; } } } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
