System.ComponentModel.DebugTypeDescriptor.Refresh C# (CSharp) Method

Refresh() public static method

public static Refresh ( object component ) : void
component object
return void
        public static void Refresh(object component) {

            if (component == null) {
                return;
            }

            // COM objects aren't cached since we don't
            // want to be holding references to them.
            if (System.Runtime.InteropServices.Marshal.IsComObject(component)) {
                return;
            }

            // We only fire the change event if we have cached the componet.
            // Since we will recreate the cache entry if anyone has asked for
            // this component... this prevents getting tons of duplicate
            // Refresh events.
            //
            ComponentEntry entry = null;
            
            lock(cachedComponentEntries) {
                entry = (ComponentEntry)cachedComponentEntries[component.GetType()];
            }
            
            if (entry != null) {

                // Clear the attribute cache.  It's not that expensive to build
                // this back up if we need to.
                //
                lock(attributeCache) {
                    attributeCache.Clear();
                }
                
                // Remove the item from the cache, it will get recreated
                // on demand.
                //
                lock(cachedComponentEntries) {
                    cachedComponentEntries.Remove(component.GetType());
                }

                // Allow the entry to dispose itself.
                //
                entry.Dispose(component);

                // Notify listeners of the change
                //
                RefreshEventHandler handler = refreshHandler;
                
                if (handler != null) {
                    handler(new RefreshEventArgs(component));
                }
            }
        }

Same methods

DebugTypeDescriptor::Refresh ( Assembly assembly ) : void
DebugTypeDescriptor::Refresh ( Module module ) : void
DebugTypeDescriptor::Refresh ( Type type ) : void