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 nullptr if that object does not exist. |
![]() | GetName | Gets the name of the specified object, or nullptr 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.Drawing.dll> #using <System.dll> #using <System.Design.dll> using namespace System; using namespace System::CodeDom; using namespace System::ComponentModel; using namespace System::ComponentModel::Design; using namespace System::ComponentModel::Design::Serialization; using namespace System::Drawing; using namespace System::Windows::Forms; namespace CodeDomSerializerSample { ref class MyComponent; private ref class MyCodeDomSerializer: public CodeDomSerializer { public: Object^ Deserialize( IDesignerSerializationManager^ manager, Object^ codeObject ) new { // This is how we associate the component with the serializer. CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( manager->GetSerializer( MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); /* This is the simplest case, in which the class just calls the base class to do the work. */ return baseClassSerializer->Deserialize( manager, codeObject ); } Object^ Serialize( IDesignerSerializationManager^ manager, Object^ value ) new { /* Associate the component with the serializer in the same manner as with Deserialize */ CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( manager->GetSerializer( MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); Object^ codeObject = baseClassSerializer->Serialize( manager, value ); /* Anything could be in the codeObject. This sample operates on a CodeStatementCollection. */ if ( (CodeStatementCollection^)(codeObject) ) { 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 = gcnew CodeCommentStatement( commentText ); statements->Insert( 0, comment ); } return codeObject; } }; [DesignerSerializer(CodeDomSerializerSample::MyCodeDomSerializer::typeid, CodeDomSerializer::typeid)] public ref class MyComponent: public Component { private: String^ localProperty; public: MyComponent() { localProperty = "Component Property Value"; } property String^ LocalProperty { String^ get() { return localProperty; } void set( String^ value ) { 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.
