Class LogixExtensions
- Namespace
- L5Sharp
- Assembly
- L5Sharp.dll
Container for all public extensions methods that add additional functionality to the base elements of the library.
public static class LogixExtensions
- Inheritance
-
LogixExtensions
- Inherited Members
Methods
Contains<TComponent>(LogixContainer<TComponent>, string)
Determines if a component with the specified name exists in the container.
public static bool Contains<TComponent>(this LogixContainer<TComponent> container, string name) where TComponent : LogixComponent<TComponent>
Parameters
container
LogixContainer<TComponent>The logix container of component objets.
name
stringThe name of the component to find.
Returns
- bool
true
if a component with the specified name exists; otherwise,false
.
Type Parameters
TComponent
Find<TComponent>(LogixContainer<TComponent>, string)
Returns a component with the specified name if it exists in the container, otherwise returns null
.
public static TComponent? Find<TComponent>(this LogixContainer<TComponent> container, string name) where TComponent : LogixComponent<TComponent>
Parameters
container
LogixContainer<TComponent>The logix container of component objets.
name
stringThe name of the component to find.
Returns
- TComponent
A LogixComponent<TComponent> of the specified type if found; Otherwise,
null
.
Type Parameters
TComponent
The component type to return.
Get<TComponent>(LogixContainer<TComponent>, string)
Returns a component with the specified name from the container.
public static TComponent Get<TComponent>(this LogixContainer<TComponent> container, string name) where TComponent : LogixComponent<TComponent>
Parameters
container
LogixContainer<TComponent>The logix container of component objets.
name
stringThe name of the component to find.
Returns
- TComponent
A LogixComponent<TComponent> of the specified type.
Type Parameters
TComponent
The component type to return.
Exceptions
- InvalidOperationException
No component having
name
exists in the container.
IsTagName(string)
Determines if the current string is a value TagName string.
public static bool IsTagName(this string input)
Parameters
input
stringThe string input to analyze.
Returns
- bool
true
if the string is a valid tag name string; otherwise,false
.
LogixName(XElement)
Gets the Name
attribute value for the current XElement.
public static string LogixName(this XElement element)
Parameters
Returns
Remarks
This is a helper since we access and use the name attribute so often I just wanted to make the code more concise.
Remove<TComponent>(LogixContainer<TComponent>, string)
Removes a component with the specified name from the container.
public static void Remove<TComponent>(this LogixContainer<TComponent> container, string name) where TComponent : LogixComponent<TComponent>
Parameters
container
LogixContainer<TComponent>The logix container of component objets.
name
stringThe name of the component to remove.
Type Parameters
TComponent