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
public abstract class PrintProperty : IDisposable, System.Runtime.Serialization.IDeserializationCallback
[System.Serializable]
public abstract class PrintProperty : IDisposable, System.Runtime.Serialization.IDeserializationCallback
type PrintProperty = class
    interface IDisposable
    interface IDeserializationCallback
[<System.Serializable>]
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

在派生类中重写时,获取该对象表示的属性的名称。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 使用的非托管资源,也可以选择性地释放托管资源。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 在垃圾回收将 PrintProperty 收回之前尝试释放资源并执行其他清理操作。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.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InternalDispose(Boolean)

释放正在由 PrintProperty 占用的非托管资源,还可以另外再释放托管资源。Releases the unmanaged resources that are being used by the PrintProperty and optionally releases the managed resources.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnDeserialization(Object)

在派生类中重写时,实现 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)

适用于