Auf Englisch lesen

Teilen über


PrintSystemObject.PropertiesCollection Eigenschaft

Definition

Ruft eine Auflistung mit Attribut-Wert-Paaren ab.

C#
public System.Printing.IndexedProperties.PrintPropertyDictionary PropertiesCollection { get; }

Eigenschaftswert

Ein PrintPropertyDictionary, das Attribut-Wert-Paare enthält.

Beispiele

Im folgenden Beispiel wird gezeigt, wie Sie diese Eigenschaft verwenden, um zur Laufzeit die Eigenschaften und die Typen dieser Eigenschaften eines Drucksystemobjekts ohne Reflektion zu ermitteln.

C#

// Enumerate the properties, and their types, of a queue without using Reflection
LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();

PrintPropertyDictionary printQueueProperties = defaultPrintQueue.PropertiesCollection;

Console.WriteLine("These are the properties, and their types, of {0}, a {1}", defaultPrintQueue.Name, defaultPrintQueue.GetType().ToString() +"\n");

foreach (DictionaryEntry entry in printQueueProperties)
{
    PrintProperty property = (PrintProperty)entry.Value;

    if (property.Value != null)
    {
        Console.WriteLine(property.Name + "\t(Type: {0})", property.Value.GetType().ToString());
    }
}
Console.WriteLine("\n\nPress Return to continue...");
Console.ReadLine();

Gilt für:

Produkt Versionen
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9