Table of Contents

Class TypeUtilitarian

Namespace
Cobilas
Assembly
Cobilas.Core.dll

Utility static class to obtain type or assembly.

public static class TypeUtilitarian
Inheritance
TypeUtilitarian
Inherited Members

Methods

GetAssemblies()

Get all assemblies for the current domain.

public static Assembly[] GetAssemblies()

Returns

Assembly[]

Returns a list of all assemblies in the current application domain.

GetAssembly(string?)

Get a specific assembly by its full name.

public static Assembly? GetAssembly(string? assemblyName)

Parameters

assemblyName string

The full name of the assembly to retrieve.

Returns

Assembly

The requested Assembly if found; otherwise, null.

Remarks

This method searches the current application domain for an assembly with the exact full name.

Exceptions

ArgumentException

Thrown when assemblyName is null or empty.

GetType(string, string?)

Get a specific type.

public static Type GetType(string fullName, string? assemblyName = null)

Parameters

fullName string

The full name of the type (e.g., System.String).

assemblyName string

The full name of the assembly to search in. If null, all assemblies are searched.

Returns

Type

Returns the type that was specified in the parameter.

If the specified type is not found, returns the Null type.

Remarks

This method searches for a type by its full name (including namespace). If not found, it returns the type of Null.

GetTypes(string?)

Get all types of assembly.

public static Type[] GetTypes(string? assemblyName = null)

Parameters

assemblyName string

The full name of the assembly to get types from. If null, types from all assemblies are returned.

Returns

Type[]

Returns all types of objects from the specified assembly or from all assemblies.

Remarks

When assemblyName is null, this method returns types from all loaded assemblies. Otherwise, it returns types only from the specified assembly.

Exceptions

AssemblyNotFoundException

Thrown when the specified assembly name is not found.

TypeExist(string, string?)

Checks if the type exists.

public static bool TypeExist(string fullName, string? assemblyName = null)

Parameters

fullName string

The full name of the type (e.g., System.String).

assemblyName string

The full name of the assembly to search in. If null, all assemblies are searched.

Returns

bool

Returns true when the type exists; otherwise, false.

Remarks

This method compares the type's full name (including namespace) with the provided fullName.