SerializerWriter Konstruktor

Definition

Initialisiert eine neue Instanz der SerializerWriter-Klasse.

protected:
 SerializerWriter();
protected SerializerWriter ();
Protected Sub New ()

Beispiele

Im folgenden Beispiel wird gezeigt, wie Sie eine SerializerWriter Verwendung SerializerProvidererstellen.CreateSerializerWriter -Methode.

// 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;
}

Hinweise

Instanzen von SerializerWriter Objekten sollten mithilfe der CreateSerializerWriter Methode eines Objekts erstellt werden, nicht die CreateSerializerWriter Methode eines SerializerProvider ISerializerFactory Objekts.

Gilt für