Table of Contents

AssemblyContext Class

Definition

Namespace
Cuemon.Reflection
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Reflection/AssemblyContext.cs

Provides a set of static methods and properties to manage and filter assemblies in the current application domain.

public static class AssemblyContext
Inheritance
object
AssemblyContext

Examples

The following example demonstrates how to filter and enumerate loaded assemblies using AssemblyContext. It retrieves all assemblies whose name starts with "Cuemon" and prints each assembly name.

using System;
using System.Linq;
using Cuemon.Reflection;

namespace Cuemon.Reflection;

public class AssemblyContextExample
{
    public void Demonstrate()
    {
        var assemblies = AssemblyContext.GetCurrentDomainAssemblies(options =>
        {
            options.AssemblyFilter = a => a.FullName?.StartsWith("Cuemon") == true;
        });

        foreach (var assembly in assemblies)
        {
            Console.WriteLine($"Assembly: {assembly.GetName().Name}");
        }
    }
}

Methods

Name Description
GetCurrentDomainAssemblies(Action<AssemblyContextOptions>)

Gets the qualified assemblies from the current application domain.