แก้ไข

แชร์ผ่าน


PrintProperty Class

Definition

Represents a property (and the value of the property) of a printing system hardware or software component.

public ref class PrintProperty abstract : IDisposable, System::Runtime::Serialization::IDeserializationCallback
[System.Serializable]
public abstract class PrintProperty : IDisposable, System.Runtime.Serialization.IDeserializationCallback
public abstract class PrintProperty : IDisposable, System.Runtime.Serialization.IDeserializationCallback
[<System.Serializable>]
type PrintProperty = class
    interface IDisposable
    interface IDeserializationCallback
type PrintProperty = class
    interface IDisposable
    interface IDeserializationCallback
Public MustInherit Class PrintProperty
Implements IDeserializationCallback, IDisposable
Inheritance
PrintProperty
Derived
Attributes
Implements

Examples

The following example shows how to use this class 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()

Constructors

PrintProperty(String)

Initializes a new instance of the PrintProperty class.

Properties

IsDisposed

Gets or sets a value that indicates whether the object has been disposed.

IsInitialized

Gets or sets a value that indicates whether the object has been initialized.

Name

When overridden in a derived class, gets the name of the property that the object represents.

Value

When overridden in a derived class, gets or sets the value of the property that the object represents.

Methods

Dispose()

Releases all resources that are being used by the PrintProperty.

Dispose(Boolean)

Releases the unmanaged resources that are being used by the PrintProperty and optionally releases the managed resources.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize()

Enables a PrintProperty to attempt to free resources and to perform other cleanup operations before the PrintProperty is reclaimed by garbage collection.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InternalDispose(Boolean)

Releases the unmanaged resources that are being used by the PrintProperty and optionally releases the managed resources.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnDeserialization(Object)

When overridden in a derived class, implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to