Freigeben über


SerializerDescriptor.DisplayName Eigenschaft

Definition

Ruft den öffentlichen Anzeigenamen des Serialisierungsprogramms ab.

public:
 property System::String ^ DisplayName { System::String ^ get(); };
public string DisplayName { get; }
member this.DisplayName : string
Public ReadOnly Property DisplayName As String

Eigenschaftswert

Der öffentliche Anzeigename des Serialisierungsprogramms.

Beispiele

Das folgende Beispiel zeigt die Verwendung DisplayName zum Abrufen und Anzeigen des öffentlichen Namens eines Plug-In-Serialisierungsprogramms.

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

Gilt für: