PrintProperty.Value PrintProperty.Value PrintProperty.Value PrintProperty.Value Property

Definition

Ruft beim Überschreiben in einer abgeleiteten Klasse ruft ab oder legt den Wert der Eigenschaft, die das Objekt darstellt.When overridden in a derived class, gets or sets the value of the property that the object represents.

public:
 abstract property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
public abstract object Value { get; set; }
member this.Value : obj with get, set
Public MustOverride Property Value As Object

Eigenschaftswert

Beispiele

Das folgende Beispiel zeigt, wie Sie diese Eigenschaft verwenden, um zur Laufzeit die Eigenschaften und die Typen von Eigenschaften eines Drucksystemobjekts, ermitteln ohne Verwendung von Reflektion.The following example shows how to use this property to discover at run time the properties, and the types of those properties, of a print system object, without using reflection.


// 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();


' Enumerate the properties, and their types, of a queue without using Reflection
Dim localPrintServer As New LocalPrintServer()
Dim defaultPrintQueue As PrintQueue = LocalPrintServer.GetDefaultPrintQueue()

Dim printQueueProperties As PrintPropertyDictionary = defaultPrintQueue.PropertiesCollection

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

For Each entry As DictionaryEntry In printQueueProperties
	Dim [property] As PrintProperty = CType(entry.Value, PrintProperty)

	If [property].Value IsNot Nothing Then
		Console.WriteLine([property].Name & vbTab & "(Type: {0})", [property].Value.GetType().ToString())
	End If
Next entry
Console.WriteLine(vbLf & vbLf & "Press Return to continue...")
Console.ReadLine()

Gilt für: