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
assemblyAssemblyThe 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
assemblyAssemblyThe assembly to inspect.
fullNameboolIf true, returns full assembly names; otherwise returns name and version.
Returns
Exceptions
- ArgumentNullException
Thrown when
assemblyis null.
Name(Assembly)
Gets the name of the assembly.
public static string? Name(this Assembly assembly)
Parameters
assemblyAssemblyThe assembly to get the name from.
Returns
- string
The name of the assembly, or null if not available.
Exceptions
- ArgumentNullException
Thrown when
assemblyis null.
ProgramInfo(Assembly)
Extracts comprehensive program information from the assembly.
public static IProgramInfo ProgramInfo(this Assembly assembly)
Parameters
assemblyAssemblyThe assembly to extract information from.
Returns
- IProgramInfo
An IProgramInfo object containing name, description, version, and component information.
Exceptions
- ArgumentNullException
Thrown when
assemblyis 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
assemblyAssemblyThe assembly instance which from resource will be retrevied.
namestringThe resource name.
Returns
Version(Assembly)
Gets the version of the assembly in the format "major.minor.build.revision".
public static string? Version(this Assembly assembly)
Parameters
assemblyAssemblyThe assembly to get the version from.
Returns
- string
The formatted version string, or null if not available.
Exceptions
- ArgumentNullException
Thrown when
assemblyis null.- VersionException
Thrown when there is an error retrieving the version information.