System.Reflection.MetadataLoadContext 8.0.0-preview.5.23280.8
About
Provides read-only reflection on assemblies in an isolated context with support for assemblies that target different processor architectures and runtimes. Using MetadataLoadContext enables you to inspect assemblies without loading them into the main execution context. Assemblies in MetadataLoadContext are treated only as metadata, that is, you can read information about their members, but cannot execute any code contained in them.
For more information, see the documentation:
- How to: Inspect assembly contents using MetadataLoadContext
- System.Reflection.MetadataLoadContext
- System.Reflection.MetadataAssemblyResolver
Example
The following example shows how to print the list of types defined in an assembly.
using System;
using System.Reflection;
class Program
{
static void Main()
{
string inspectedAssembly = "Example.dll";
var resolver = new PathAssemblyResolver(new string[] {inspectedAssembly, typeof(object).Assembly.Location});
using var mlc = new MetadataLoadContext(resolver, typeof(object).Assembly.GetName().ToString());
// Load assembly into MetadataLoadContext
Assembly assembly = mlc.LoadFromAssemblyPath(inspectedAssembly);
AssemblyName name = assembly.GetName();
// Print types defined in assembly
Console.WriteLine($"{name.Name} has following types: ");
foreach (Type t in assembly.GetTypes())
{
Console.WriteLine(t.FullName);
}
}
}
Showing the top 20 packages that depend on System.Reflection.MetadataLoadContext.
Packages | Downloads |
---|---|
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
57 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
42 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
39 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
37 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
35 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
34 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
28 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
25 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
24 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
20 |
Microsoft.Build
This package contains the Microsoft.Build assembly which is used to create, edit, and evaluate MSBuild projects.
|
17 |
.NET Framework 4.6.2
- System.Collections.Immutable (>= 8.0.0-preview.5.23280.8)
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 8.0.0-preview.5.23280.8)
.NET Standard 2.0
- System.Memory (>= 4.5.5)
- System.Reflection.Metadata (>= 8.0.0-preview.5.23280.8)
- System.Collections.Immutable (>= 8.0.0-preview.5.23280.8)
.NET 8.0
- System.Collections.Immutable (>= 8.0.0-preview.5.23280.8)
- System.Reflection.Metadata (>= 8.0.0-preview.5.23280.8)
.NET 7.0
- System.Reflection.Metadata (>= 8.0.0-preview.5.23280.8)
- System.Collections.Immutable (>= 8.0.0-preview.5.23280.8)
.NET 6.0
- System.Reflection.Metadata (>= 8.0.0-preview.5.23280.8)
- System.Collections.Immutable (>= 8.0.0-preview.5.23280.8)