Class ModuleExtensions
Extensions for ILisrtModule interface.
Inherited Members
Namespace: Loehnert.Lisrt.Modules
Assembly: Loehnert.Lisrt.Modules.dll
Syntax
public static class ModuleExtensions
Methods
ExitRecursively(ILisrtModule, Boolean)
Exit the ILisrtModule instance and all SubModules which have the IInitializable interface implemented.
Declaration
public static bool ExitRecursively(this ILisrtModule module, bool throwException)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule which should be exited recursively. |
Boolean | throwException | If false, exceptions thrown in the Exit() method, will be caught and shown (See: ShowException(Exception, ILogger)). |
Returns
Type | Description |
---|---|
Boolean | True, if all IInitializable modules could be exited. |
ExitRecursively(IEnumerable<ILisrtModule>, Boolean)
Exit the ILisrtModule instances and all SubModules which have the IInitializable interface implemented.
Declaration
public static bool ExitRecursively(this IEnumerable<ILisrtModule> modules, bool throwException)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ILisrtModule> | modules | The ILisrtModuleenumeration which should be exited recursively. |
Boolean | throwException | If false, exceptions thrown in the Exit() method, will be caught and shown (See: ShowException(Exception, ILogger)). |
Returns
Type | Description |
---|---|
Boolean | True, if all IInitializable modules could be exited. |
GetAllModules(ILisrtModule)
Gets an enumeration, that contains the module
and all sub modules (recursive).
Declaration
public static IEnumerable<ILisrtModule> GetAllModules(this ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | Module whose submodules are returned. |
Returns
Type | Description |
---|---|
IEnumerable<ILisrtModule> | The enumeration of modules. |
GetAllModules<T>(ILisrtModule)
Gets an enumeration, that contains the module
and all sub modules (recursive) of type T
.
Declaration
public static IEnumerable<T> GetAllModules<T>(this ILisrtModule module)
where T : ILisrtModule
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | Module whose submodules are returned. |
Returns
Type | Description |
---|---|
IEnumerable<T> | The enumeration of modules. |
Type Parameters
Name | Description |
---|---|
T | Type of modules to get. |
GetFullName(ILisrtModule)
Gets the full name of ILisrtModule. Module names are separated by '.'.
Declaration
public static string GetFullName(this ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule with the name. |
Returns
Type | Description |
---|---|
String | The full name. |
Remarks
E.g. 'root.branch.leaf'.
GetLevel(ILisrtModule)
Gets the level of the module e.g.: 'root.branch.leaf' level of root = 0, level of leaf = 2.
Declaration
public static int GetLevel(this ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule with the searched level. |
Returns
Type | Description |
---|---|
System.Int32 | Level (level of root is 0). |
GetRoot(ILisrtModule)
Gets the root module.
Declaration
public static ILisrtModule GetRoot(this ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The module which has the root module as parent or parent-parent. |
Returns
Type | Description |
---|---|
ILisrtModule | The root module. |
IsRoot(ILisrtModule)
Gets a value indicating whether it is the root module of a ILisrtModule tree.
Declaration
public static bool IsRoot(this ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule which should be proofed. |
Returns
Type | Description |
---|---|
Boolean | True if it is the root ILisrtModule instance. |