Skip to content

Instantly share code, notes, and snippets.

@brainwipe
Created February 22, 2016 13:35
Show Gist options
  • Save brainwipe/2a925070dc4f64b0a4b1 to your computer and use it in GitHub Desktop.
Save brainwipe/2a925070dc4f64b0a4b1 to your computer and use it in GitHub Desktop.
Find all loaded types in ASP.NET Core, C# snippet
// Prior to ASP.NET Core, you had access to the AppDomain and all the loaded assemblies.
using Microsoft.AspNet.Mvc.Infrastructure;
using Microsoft.Extensions.PlatformAbstractions;
// Snip...
var assemblyProvider = new DefaultAssemblyProvider(PlatformServices.Default.LibraryManager);
var resourceControllers = assemblyProvider.CandidateAssemblies
.SelectMany(x => x.DefinedTypes)
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment