System.Threading.TObjectCaches

From RAD Studio API Documentation
Jump to: navigation, search

System.Generics.Collections.TObjectDictionarySystem.Generics.Collections.TDictionarySystem.Generics.Collections.TEnumerableSystem.TObjectTObjectCaches

Delphi

TObjectCaches = class(TObjectDictionary<TClass, TObjectCache>)

C++

class PASCALIMPLEMENTATION TObjectCaches : public System::Generics::Collections::TObjectDictionary__2<System::TClass,TObjectCache*>

Properties

Type Visibility Source Unit Parent
class public
System.Threading.pas
System.Threading.hpp
System.Threading System.Threading

Description

Collection of key and/or value objects.

System.Threading.TObjectCaches inherits from System.Generics.Collections.TObjectDictionary. All content below this line refers to System.Generics.Collections.TObjectDictionary.

Collection of key and/or value objects.

TObjectDictionary represents a generic collection of key and/or value objects. It can handle keys as objects, values as objects, or both as objects.

TObjectDictionary has the capability to handle objects' lifetime automatically. When a TObjectDictionary is instantiated, an Ownerships parameter specifies whether the dictionary owns the keys, values, or both. In the Create method, the type arguments are checked dynamically. If no Ownership is specified (the empty set), then the functionally of TObjectDictionary is identical to that of TDictionary.

Access methods

This section summarizes methods for reading and writing TDictionary or TObjectDictionary, including the effect of duplicate keys when writing, or key not found when reading.

Write

Method Index type Value type If duplicate key
Add TKey TValue Exception
AddOrSetValue TKey TValue Overwrite
Items TKey TValue Overwrite

Read

Method Index/input type Result type If key not found Notes
ContainsKey TKey Boolean false True = found
ContainsValue TValue Boolean n/a True = found
ExtractPair TKey TPair Default pair Returns TPair, removes item from dictionary
Items TKey TValue Exception Use TryGetValue to avoid exception
operator [] TKey TValue Exc C++ only
Keys n/a TKeyCollection n/a
ToArray n/a TArray<TPair<TKey,TValue>> n/a
TryGetValue TKey TValue, Boolean default,false Like Items[] without exception
Values n/a TValueCollection n/a

See Also