PrintPropertyDictionary PrintPropertyDictionary PrintPropertyDictionary PrintPropertyDictionary Class

定義

プロパティと内のオブジェクトに関連付けられている値のコレクションを表します、System.Printing名前空間。Represents a collection of properties and values that are associated with an object in the System.Printing namespace.

public ref class PrintPropertyDictionary : System::Collections::Hashtable, IDisposable
[System.Serializable]
public class PrintPropertyDictionary : System.Collections.Hashtable, IDisposable
type PrintPropertyDictionary = class
    inherit Hashtable
    interface ISerializable
    interface IDeserializationCallback
    interface IDisposable
Public Class PrintPropertyDictionary
Inherits Hashtable
Implements IDisposable
継承
PrintPropertyDictionaryPrintPropertyDictionaryPrintPropertyDictionaryPrintPropertyDictionary
属性
実装

次の例では、このクラスを使用して、場所、ポート、および共有状態でのみ、既存のプリンターのプロパティとは異なる 2 つ目のプリンターをインストールする方法を示します。The following example shows how to use this class to install a second printer that differs in its properties from an existing printer only in location, port, and shared status.

LocalPrintServer myLocalPrintServer = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
PrintQueue sourcePrintQueue = myLocalPrintServer.DefaultPrintQueue;
PrintPropertyDictionary myPrintProperties = sourcePrintQueue.PropertiesCollection;

// Share the new printer using Remove/Add methods
PrintBooleanProperty shared = new PrintBooleanProperty("IsShared", true);
myPrintProperties.Remove("IsShared");
myPrintProperties.Add("IsShared", shared);

// Give the new printer its share name using SetProperty method
PrintStringProperty theShareName = new PrintStringProperty("ShareName", "\"Son of " + sourcePrintQueue.Name +"\"");
myPrintProperties.SetProperty("ShareName", theShareName);

// Specify the physical location of the new printer using Remove/Add methods
PrintStringProperty theLocation = new PrintStringProperty("Location", "the supply room");
myPrintProperties.Remove("Location");
myPrintProperties.Add("Location", theLocation);

// Specify the port for the new printer
String[] port = new String[] { "COM1:" };


// Install the new printer on the local print server
PrintQueue clonedPrinter = myLocalPrintServer.InstallPrintQueue("My clone of " + sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties);
myLocalPrintServer.Commit();

// Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName);
Console.WriteLine("Press Return to continue ...");
Console.ReadLine();
Dim myLocalPrintServer As New LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer)
Dim sourcePrintQueue As PrintQueue = myLocalPrintServer.DefaultPrintQueue
Dim myPrintProperties As PrintPropertyDictionary = sourcePrintQueue.PropertiesCollection

' Share the new printer using Remove/Add methods
Dim [shared] As New PrintBooleanProperty("IsShared", True)
myPrintProperties.Remove("IsShared")
myPrintProperties.Add("IsShared", [shared])

' Give the new printer its share name using SetProperty method
Dim theShareName As New PrintStringProperty("ShareName", """Son of " & sourcePrintQueue.Name & """")
myPrintProperties.SetProperty("ShareName", theShareName)

' Specify the physical location of the new printer using Remove/Add methods
Dim theLocation As New PrintStringProperty("Location", "the supply room")
myPrintProperties.Remove("Location")
myPrintProperties.Add("Location", theLocation)

' Specify the port for the new printer
Dim port() As String = { "COM1:" }


' Install the new printer on the local print server
Dim clonedPrinter As PrintQueue = myLocalPrintServer.InstallPrintQueue("My clone of " & sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties)
myLocalPrintServer.Commit()

' Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName)
Console.WriteLine("Press Return to continue ...")
Console.ReadLine()

次の例は、このクラスを使用して、リフレクションを使用せず、プロパティ、および印刷システム オブジェクトでは、これらのプロパティの種類の実行時に検出する方法を示しています。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()

注釈

コレクションには、形式、Hashtableディクショナリ。The collection takes the form of a Hashtable dictionary. Valueの各プロパティDictionaryEntryから派生したクラスのインスタンスは、コレクション内でPrintPropertyします。The Value property of each DictionaryEntry in the collection is an instance of a class that is derived from PrintProperty.

コンストラクター

PrintPropertyDictionary() PrintPropertyDictionary() PrintPropertyDictionary() PrintPropertyDictionary()

PrintPropertyDictionary クラスの新しいインスタンスを初期化します。Initializes a new instance of the PrintPropertyDictionary class.

PrintPropertyDictionary(SerializationInfo, StreamingContext) PrintPropertyDictionary(SerializationInfo, StreamingContext) PrintPropertyDictionary(SerializationInfo, StreamingContext) PrintPropertyDictionary(SerializationInfo, StreamingContext)

新しいインスタンスを初期化、PrintPropertyDictionaryクラスし、指定した提供SerializationInfoStreamingContextします。Initializes a new instance of the PrintPropertyDictionary class and provides it with the specified SerializationInfo and StreamingContext.

メソッド

Add(Object, Object) Add(Object, Object) Add(Object, Object) Add(Object, Object)

指定したキーおよび値を持つ要素を Hashtable に追加します。Adds an element with the specified key and value into the Hashtable.

(Inherited from Hashtable)
Add(PrintProperty) Add(PrintProperty) Add(PrintProperty) Add(PrintProperty)

指定したオブジェクトを追加します (から派生したクラスのPrintProperty)、ディクショナリにします。Adds the specified object (of a class that is derived from PrintProperty) into the dictionary.

Clear() Clear() Clear() Clear()

Hashtable からすべての要素を削除します。Removes all elements from the Hashtable.

(Inherited from Hashtable)
Clone() Clone() Clone() Clone()

Hashtable の簡易コピーを作成します。Creates a shallow copy of the Hashtable.

(Inherited from Hashtable)
Contains(Object) Contains(Object) Contains(Object) Contains(Object)

Hashtable に特定のキーが格納されているかどうかを判断します。Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsKey(Object) ContainsKey(Object) ContainsKey(Object) ContainsKey(Object)

Hashtable に特定のキーが格納されているかどうかを判断します。Determines whether the Hashtable contains a specific key.

(Inherited from Hashtable)
ContainsValue(Object) ContainsValue(Object) ContainsValue(Object) ContainsValue(Object)

Hashtable に特定の値が格納されているかどうかを判断します。Determines whether the Hashtable contains a specific value.

(Inherited from Hashtable)
CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

1 次元の Hashtable インスタンスの指定したインデックスに Array の要素をコピーします。Copies the Hashtable elements to a one-dimensional Array instance at the specified index.

(Inherited from Hashtable)
Dispose() Dispose() Dispose() Dispose()

使用されているすべてのリソースを解放、PrintPropertyDictionaryします。Releases all the resources that are being used by the PrintPropertyDictionary.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

によって使用されているアンマネージ リソースを解放、PrintPropertyDictionaryマネージ リソースも解放します。Releases the unmanaged resources that are being used by the PrintPropertyDictionary and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Hashtable を反復処理する IDictionaryEnumerator を返します。Returns an IDictionaryEnumerator that iterates through the Hashtable.

(Inherited from Hashtable)
GetHash(Object) GetHash(Object) GetHash(Object) GetHash(Object)

指定したキーのハッシュ コードを返します。Returns the hash code for the specified key.

(Inherited from Hashtable)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

設定、SerializationInfoをシリアル化するために必要なデータをPrintPropertyDictionaryします。Populates a SerializationInfo with the data that is needed to serialize the PrintPropertyDictionary.

GetProperty(String) GetProperty(String) GetProperty(String) GetProperty(String)

オブジェクトを取得します (から派生したクラスのPrintProperty) を表す、指定されたプロパティ。Gets the object (of a class that is derived from PrintProperty) that represents the specified property.

GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object) KeyEquals(Object, Object)

特定の ObjectHashtable 内の特定のキーと比較します。Compares a specific Object with a specific key in the Hashtable.

(Inherited from Hashtable)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object)

ISerializable インターフェイスを実装し、逆シリアル化が完了したときに逆シリアル化イベントを発生させます。Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

Remove(Object) Remove(Object) Remove(Object) Remove(Object)

指定したキーを持つ要素を Hashtable から削除します。Removes the element with the specified key from the Hashtable.

(Inherited from Hashtable)
SetProperty(String, PrintProperty) SetProperty(String, PrintProperty) SetProperty(String, PrintProperty) SetProperty(String, PrintProperty)

派生したクラスのオブジェクトに指定した属性の値を設定PrintPropertyします。Sets the value of the specified attribute to an object of a class that is derived from PrintProperty.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

プロパティ

comparer comparer comparer comparer

IComparer で使用する Hashtable を取得または設定します。Gets or sets the IComparer to use for the Hashtable.

(Inherited from Hashtable)
Count Count Count Count

Hashtable に格納されているキー/値ペアの数を取得します。Gets the number of key/value pairs contained in the Hashtable.

(Inherited from Hashtable)
EqualityComparer EqualityComparer EqualityComparer EqualityComparer

IEqualityComparer に使用する Hashtable を取得します。Gets the IEqualityComparer to use for the Hashtable.

(Inherited from Hashtable)
hcp hcp hcp hcp

ハッシュ コードを提供できるオブジェクトを取得または設定します。Gets or sets the object that can dispense hash codes.

(Inherited from Hashtable)
IsFixedSize IsFixedSize IsFixedSize IsFixedSize

Hashtable が固定サイズかどうかを示す値を取得します。Gets a value indicating whether the Hashtable has a fixed size.

(Inherited from Hashtable)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Hashtable が読み取り専用かどうかを示す値を取得します。Gets a value indicating whether the Hashtable is read-only.

(Inherited from Hashtable)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

Hashtable へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。Gets a value indicating whether access to the Hashtable is synchronized (thread safe).

(Inherited from Hashtable)
Item[Object] Item[Object] Item[Object] Item[Object]

指定されたキーに関連付けられている値を取得または設定します。Gets or sets the value associated with the specified key.

(Inherited from Hashtable)
Keys Keys Keys Keys

Hashtable 内のキーを格納している ICollection を取得します。Gets an ICollection containing the keys in the Hashtable.

(Inherited from Hashtable)
SyncRoot SyncRoot SyncRoot SyncRoot

Hashtable へのアクセスを同期するために使用できるオブジェクトを取得します。Gets an object that can be used to synchronize access to the Hashtable.

(Inherited from Hashtable)
Values Values Values Values

ICollection 内の値を格納している Hashtable を取得します。Gets an ICollection containing the values in the Hashtable.

(Inherited from Hashtable)

明示的なインターフェイスの実装

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

コレクションを反復処理する列挙子を返します。Returns an enumerator that iterates through a collection.

(Inherited from Hashtable)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

要素をキャストするIEnumerable指定した型にします。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

要素をフィルター処理、IEnumerable指定した型に基づいています。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

クエリの並列化を有効にします。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

変換、IEnumerableIQueryableします。Converts an IEnumerable to an IQueryable.

適用対象