public void Dispose()
 {
     if (_applicationManager != null)
     {
         _applicationManager.Dispose();
         _applicationManager = null;
     }
     _langurageWriterConfiguration = null;
     _serviceProvider = null;
 }
        public SimpleReflector()
        {
            _applicationManager = new ApplicationManager(null);
            _serviceProvider    = _applicationManager;

            _langurageWriterConfiguration            = new LanguageWriterConfiguration();
            _langurageWriterConfiguration.Visibility = this.VisibilityConfiguration;

            _langurageWriterConfiguration["ShowCustomAttributes"]      = "true";
            _langurageWriterConfiguration["ShowNamespaceImports"]      = "true";
            _langurageWriterConfiguration["ShowNamespaceBody"]         = "true";
            _langurageWriterConfiguration["ShowTypeDeclarationBody"]   = "true";
            _langurageWriterConfiguration["ShowMethodDeclarationBody"] = "true";
            _langurageWriterConfiguration["ShowDocumentation"]         = "false";

            IConfiguration configAssemblyBrowser = this.ConfigurationManager["AssemblyBrowser"];

            configAssemblyBrowser.SetProperty("AutoResolve", "false");
            configAssemblyBrowser.SetProperty("FlattenNamespaces", "false");
            configAssemblyBrowser.SetProperty("ShowInheritedMembers", "false");
            configAssemblyBrowser.SetProperty("SideBySideVersioning", "false");
            configAssemblyBrowser.SetProperty("Visibility", "*"); //*,PublicOnly

            IConfiguration configDisassembler = this.ConfigurationManager["Disassembler"];

            configDisassembler.SetProperty("ShowSymbols", "true");
            configDisassembler.SetProperty("Indentation", "4");
            configDisassembler.SetProperty("NumberFormat", "Auto");  //Auto,Hexadecimal,Decimal
            configDisassembler.SetProperty("Documentation", "None"); //Formatted,Xml,None

            //configDisassembler.SetProperty("Optimization", OptimizationDefault);//None,1.0,2.0,3.5,4.0
            SetOptimization(OptimizationDefault);

            AssemblyManager.Resolver = new AssemblyResolver(this.AssemblyManager);
            AssemblyManager.Comparer = configAssemblyBrowser.GetProperty("SideBySideVersioning", "false") == "true" ? null : new AssemblyComparer();

            string[] strArray = new string[] { @"%SystemRoot%\Microsoft.net", @"%ProgramFiles%\Reference Assemblies", @"%ProgramFiles%\Microsoft.net", @"%ProgramFiles%\Microsoft Silverlight" };
            AssemblyCache.Directories.AddRange(strArray);

            this.Language      = "C#";
            this.FormatterType = typeof(RichTextFormatter);

            //LoadSystemAssemblies();
        }