PrintProperty 類別

定義

表示列印系統硬體或軟體元件的屬性 (及其屬性的值)。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
type PrintProperty = class
    interface IDisposable
    interface IDeserializationCallback
Public MustInherit Class PrintProperty
Implements IDeserializationCallback, IDisposable
繼承
PrintProperty
衍生
屬性
實作

範例

下列範例顯示如何使用這個類別,在執行時間探索列印系統物件的屬性,以及這些屬性的類型,而不使用反映。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()

建構函式

PrintProperty(String)

初始化 PrintProperty 類別的新執行個體。Initializes a new instance of the PrintProperty class.

屬性

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

在衍生類別 (Derived Class) 中覆寫時,會取得物件所表示屬性的名稱。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.

方法

Dispose()

釋放 PrintProperty 正在使用的所有資源。Releases all resources that are being used by the PrintProperty.

Dispose(Boolean)

釋放 PrintProperty 正在使用的 Unmanaged 資源,並且可選擇釋放 Managed 資源。Releases the unmanaged resources that are being used by the PrintProperty and optionally releases the managed resource.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Finalize()

可讓 PrintProperty 嘗試釋放資源,並執行其他清除作業,不必等到記憶體回收利用 PrintPropertyEnables 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.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
InternalDispose(Boolean)

釋放 PrintProperty 正在使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources that are being used by the PrintProperty and optionally releases the managed resources.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnDeserialization(Object)

在衍生類別中覆寫時,如果還原序列化 (Deserialization) 完成,則實作 ISerializable 介面,並引發還原序列化事件。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.

(繼承來源 Object)

適用於