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

GetEditorTable() private static method

private static GetEditorTable ( Type editorBaseType ) : Hashtable
editorBaseType System.Type
return System.Collections.Hashtable
        private static Hashtable GetEditorTable(Type editorBaseType) {
            object table = null;
            
            lock(editorTables) {
                table = editorTables[editorBaseType];
            }
            
            if (table == null) {
                // Before we give up, it is possible that the
                // class initializer for editorBaseType hasn't 
                // actually run.  Force it now.  We try/catch
                // here in case editorBaseType throws us a curve ball.
                //
                if (!editorBaseType.IsAbstract) {
                    try {
                        object o = Activator.CreateInstance(editorBaseType, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, null, null);
                    }
                    catch {}
                }
                
                lock(editorTables) {
                    table = editorTables[editorBaseType];
                    
                    // If the table is still null, then throw a
                    // sentinel in there so we don't
                    // go through this again.
                    //
                    if (table == null) {
                        editorTables[editorBaseType] = editorTables;
                    }
                }
            }
            
            // Look for our sentinel value that indicates
            // we have already tried and failed to get
            // a table.
            //
            if (table == editorTables) {
                table = null;
            }
            
            return (Hashtable)table;
        }