PrintProperty 類別

定義

表示列印系統硬體或軟體元件的屬性 (及其屬性的值)。

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
繼承
PrintProperty
衍生
屬性
實作

範例

下列範例示範如何使用這個類別在執行時間探索屬性,以及列印系統物件的這些屬性類型,而不使用反映。


// 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 類別的新執行個體。

屬性

IsDisposed

取得或設定一個值,指出是否已經處置物件。

IsInitialized

取得或設定值,這個值表示物件是否已經初始化。

Name

在衍生類別 (Derived Class) 中覆寫時,會取得物件所表示屬性的名稱。

Value

在衍生類別中覆寫時,會取得或設定物件所表示屬性的值。

方法

Dispose()

釋放 PrintProperty 正在使用的所有資源。

Dispose(Boolean)

釋放 PrintProperty 正在使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
Finalize()

可讓 PrintProperty 嘗試釋放資源,並執行其他清除作業,不必等到記憶體回收利用 PrintProperty

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
InternalDispose(Boolean)

釋放 PrintProperty 正在使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnDeserialization(Object)

在衍生類別中覆寫時,如果還原序列化 (Deserialization) 完成,則實作 ISerializable 介面,並引發還原序列化事件。

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於