System.Reflection.MetadataLoadContext 10.0.0-preview.1.25080.5
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.
How to Use
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);
}
}
}
Main Types
The main types provided by this library are:
System.Reflection.MetadataLoadContextSystem.Reflection.MetadataAssemblyResolver
Additional Documentation
- How to: Inspect assembly contents using MetadataLoadContext
- System.Reflection.MetadataLoadContext
- System.Reflection.MetadataAssemblyResolver
Feedback & Contributing
System.Reflection.MetadataLoadContext is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on System.Reflection.MetadataLoadContext.
| Packages | Downloads |
|---|---|
|
GroupDocs.Conversion
GroupDocs.Conversion for .NET is a powerful and intuitive library used for documents conversion.
Convert DOC to PDF, PDF to DOC, XLS to DOC, PPT to PDF and any other popular file formats with simple, intuitive and flexible API.
For more details on the GroupDocs.Conversion for .NET API, please visit product website at:
https://products.groupdocs.com/conversion/net
Note: The library will run in evaluation mode. In order to test full features of the product, please request a free 30-day temporary license.
|
3 |
|
GroupDocs.Conversion
GroupDocs.Conversion for .NET is a powerful and intuitive library used for documents conversion.
Convert DOC to PDF, PDF to DOC, XLS to DOC, PPT to PDF and any other popular file formats with simple, intuitive and flexible API.
For more details on the GroupDocs.Conversion for .NET API, please visit product website at:
https://products.groupdocs.com/conversion/net
Note: The library will run in evaluation mode. In order to test full features of the product, please request a free 30-day temporary license.
|
2 |
.NET Framework 4.6.2
- System.Collections.Immutable (>= 10.0.0-preview.1.25080.5)
- System.Memory (>= 4.6.0)
- System.Reflection.Metadata (>= 10.0.0-preview.1.25080.5)
.NET Standard 2.0
- System.Memory (>= 4.6.0)
- System.Reflection.Metadata (>= 10.0.0-preview.1.25080.5)
- System.Collections.Immutable (>= 10.0.0-preview.1.25080.5)
.NET 10.0
- No dependencies.
.NET 9.0
- System.Reflection.Metadata (>= 10.0.0-preview.1.25080.5)
- System.Collections.Immutable (>= 10.0.0-preview.1.25080.5)
.NET 8.0
- System.Reflection.Metadata (>= 10.0.0-preview.1.25080.5)
- System.Collections.Immutable (>= 10.0.0-preview.1.25080.5)