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)

Применяется к