Table of Contents

Class Extensions

Namespace
Loehnert.Lisrt.Modules
Assembly
Loehnert.Lisrt.Modules.dll

Provides static extension methods for working with ILisrtModule implementations.

public static class Extensions
Inheritance
Extensions
Inherited Members

Methods

TryAddTo<T>(T, object)

Adds a object to a parent and the parent is a ICompositeModule implementation.

public static T TryAddTo<T>(this T @object, object parent) where T : class

Parameters

object T

Object to add.

parent object

Composite module to which the object should be added.

Returns

T

The object. You can use this as fluent API.

Type Parameters

T

Type of the object.

Exceptions

ArgumentNullException

Thrown when parent is null.

TrySetModuleName<T>(T, string, bool)

Tries to set the Name of the object if it is a ILisrtModule implementation.

public static T TrySetModuleName<T>(this T @object, string name, bool force = false) where T : class

Parameters

object T

Module to set the name.

name string

Name to set.

force bool

If true sets the name, also if the module has already a name.

Returns

T

The object. You can use this as fluent API.

Type Parameters

T

Type of the object.

Remarks

The Name property is set to name,
if object is not null
-and- the property has a public setter
-and- Name of the module is null or empty or force is true.