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

在派生类中重写时,获取该对象表示的属性的名称。

Value

在派生类中重写时,获取或设置该对象表示的属性的值。

方法

Dispose()

释放正在由 PrintProperty 使用的所有资源。

Dispose(Boolean)

释放正在由 PrintProperty 占用的非托管资源,还可以另外再释放托管资源。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
Finalize()

允许 PrintProperty 在垃圾回收将 PrintProperty 收回之前尝试释放资源并执行其他清理操作。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
InternalDispose(Boolean)

释放正在由 PrintProperty 占用的非托管资源,还可以另外再释放托管资源。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnDeserialization(Object)

在派生类中重写时,实现 ISerializable 接口,并在完成反序列化之后引发反序列化事件。

ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于