SerializerDescriptor Class

Provides information about installed plug-in serializers.

System.Object
  System.Windows.Documents.Serialization.SerializerDescriptor

Namespace:  System.Windows.Documents.Serialization
Assembly:  PresentationFramework (in PresentationFramework.dll)

public sealed class SerializerDescriptor

The SerializerDescriptor type exposes the following members.

  NameDescription
Public propertyAssemblyNameGets the name of the assembly that contains the serializer.
Public propertyAssemblyPathGets the path to the assembly file that contains the serializer.
Public propertyAssemblyVersionGets the version of the assembly that contains the serializer.
Public propertyDefaultFileExtensionGets the default extension associated with files that the serializer outputs.
Public propertyDisplayNameGets the public display name of the serializer.
Public propertyFactoryInterfaceNameGets the name of the ISerializerFactory derived class that implements the serializer.
Public propertyIsLoadableGets a value indicating whether the serializer can be loaded with the currently installed version of Microsoft .NET Framework.
Public propertyManufacturerNameGets the name of the company that developed the serializer.
Public propertyManufacturerWebsiteGets the web address of the company that developed the serializer.
Public propertyWinFXVersionGets the version of Microsoft .NET Framework required by the serializer.
Top

  NameDescription
Public methodStatic memberCreateFromFactoryInstanceCreates a new SerializerDescriptor through a given ISerializerFactory implementation.
Public methodEqualsTests two SerializerDescriptor objects for equality. (Overrides Object.Equals(Object).)
Public methodGetHashCodeGets the unique hash code value of the serializer. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Plug-in serializer classes derive from and implement the ISerializerFactory interface.

The following examples illustrate using a SerializerDescriptor to return information on installed plug-in serializers.

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found, 
// use it to output and store the document. 
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}
// ------------------------ PlugInFileFilter -------------------------- 
/// <summary> 
///   Gets a filter string for installed plug-in serializers.</summary> 
/// <remark> 
///   PlugInFileFilter is used to set the SaveFileDialog or 
///   OpenFileDialog "Filter" property when saving or opening files
///   using plug-in serializers.</remark> 
private string PlugInFileFilter
{
    get
    {   // Create a SerializerProvider for accessing plug-in serializers.
        SerializerProvider serializerProvider = new SerializerProvider();
        string filter = "";

        // For each loadable serializer, add its display 
        // name and extension to the filter string. 
        foreach (SerializerDescriptor serializerDescriptor in
            serializerProvider.InstalledSerializers)
        {
            if (serializerDescriptor.IsLoadable)
            {
                // After the first, separate entries with a "|".
                if (filter.Length > 0)   filter += "|";

                // Add an entry with the plug-in name and extension.
                filter += serializerDescriptor.DisplayName + " (*" +
                    serializerDescriptor.DefaultFileExtension + ")|*" +
                    serializerDescriptor.DefaultFileExtension;
            }
        }

        // Return the filter string of installed plug-in serializers. 
        return filter;
    }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft