Assembly: System (in system.dll)
The object for which to get the cache.
Return ValueAn IDictionary if the provided object supports caching; otherwise, a null reference (Nothing in Visual Basic).
A TypeDescriptor may need to perform complex operations on collections of metadata. Because types are not unloaded for the life of a domain, the TypeDescriptor class will automatically cache the results of these operations based on type. However, some operations use live object instances. These operations cannot be cached within the TypeDescriptor class because caching them would prevent the object from being garbage collected. Instead, the TypeDescriptor class allows for a per-object cache, accessed as an IDictionary of key/value pairs, to exist on an object. The GetCache method returns an instance of this cache. The GetCache method will return a null reference (Nothing in Visual Basic) if there is no supported cache for an object.
The default TypeDescriptionProvider used by TypeDescriptor examines the object to see if it is a sited component that implements the IDictionaryService interface. If the object is, it uses the dictionary service to store the object's cache. Otherwise, the object it returns a null reference (Nothing in Visual Basic). Other type description providers may provide their own implementation here. For example, dependency objects can just attach a property of type IDictionary.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.