Table of Contents

Class AssemblyExtensions

Namespace
NuvTools.Common.Reflection
Assembly
NuvTools.Common.dll

Provides extension methods for Assembly objects.

public static class AssemblyExtensions
Inheritance
AssemblyExtensions
Inherited Members

Methods

Description(Assembly)

Gets the description of the assembly from its AssemblyDescriptionAttribute.

public static string? Description(this Assembly assembly)

Parameters

assembly Assembly

The assembly to get the description from.

Returns

string

The description of the assembly, or null if not available.

ListComponent(Assembly, bool)

Lists all referenced assemblies (components) from the specified assembly.

public static List<string>? ListComponent(this Assembly assembly, bool fullName = false)

Parameters

assembly Assembly

The assembly to inspect.

fullName bool

If true, returns full assembly names; otherwise returns name and version.

Returns

List<string>

A list of component names, or null if the assembly is null.

Exceptions

ArgumentNullException

Thrown when assembly is null.

Name(Assembly)

Gets the name of the assembly.

public static string? Name(this Assembly assembly)

Parameters

assembly Assembly

The assembly to get the name from.

Returns

string

The name of the assembly, or null if not available.

Exceptions

ArgumentNullException

Thrown when assembly is null.

ProgramInfo(Assembly)

Extracts comprehensive program information from the assembly.

public static IProgramInfo ProgramInfo(this Assembly assembly)

Parameters

assembly Assembly

The assembly to extract information from.

Returns

IProgramInfo

An IProgramInfo object containing name, description, version, and component information.

Exceptions

ArgumentNullException

Thrown when assembly is null or assembly name is null.

Resource(Assembly, string)

Returns a Embedded Resource from assembly.

public static Stream? Resource(this Assembly assembly, string name)

Parameters

assembly Assembly

The assembly instance which from resource will be retrevied.

name string

The resource name.

Returns

Stream

Version(Assembly)

Gets the version of the assembly in the format "major.minor.build.revision".

public static string? Version(this Assembly assembly)

Parameters

assembly Assembly

The assembly to get the version from.

Returns

string

The formatted version string, or null if not available.

Exceptions

ArgumentNullException

Thrown when assembly is null.

VersionException

Thrown when there is an error retrieving the version information.