GetCache() 공개 메소드

public GetCache ( object instance ) : IDictionary
instance object
리턴 IDictionary
예제 #1
0
 /// <summary>Gets a per-object cache, accessed as an <see cref="T:System.Collections.IDictionary" /> of key/value pairs.</summary>
 /// <returns>An <see cref="T:System.Collections.IDictionary" /> if the provided object supports caching; otherwise, null.</returns>
 /// <param name="instance">The object for which to get the cache.</param>
 public virtual IDictionary GetCache(object instance)
 {
     if (_parent != null)
     {
         return(_parent.GetCache(instance));
     }
     return(null);
 }
예제 #2
0
 /// <summary>
 /// TypeDescriptor may need to perform complex operations on collections of metadata.
 /// Since types are not unloaded for the life of a domain, TypeDescriptor will
 /// automatically cache the results of these operations based on type. There are a
 /// number of operations that use live object instances, however. These operations
 /// cannot be cached within TypeDescriptor because caching them would prevent the
 /// object from garbage collecting. Instead, TypeDescriptor 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. GetCache will return
 /// null if there is no supported cache for an object.
 /// </summary>
 public virtual IDictionary?GetCache(object instance) => _parent?.GetCache(instance);