Class IOMasterExtensions
This class contains utility functions for IIOMaster implementations.
public static class IOMasterExtensions
- Inheritance
-
IOMasterExtensions
- Inherited Members
Methods
AddDigitalInputsTerminal<TTerminal>(IIOMaster, TTerminal, string, params string[])
Adds a terminal to the master and sets its name and the names of the inputs.
public static TTerminal AddDigitalInputsTerminal<TTerminal>(this IIOMaster master, TTerminal terminal, string name, params string[] inputNames) where TTerminal : IDigitalInputsTerminal, ITerminal
Parameters
master
IIOMasterMaster to add the
terminal
.terminal
TTerminalTerminal to add.
name
stringName of the terminal.
inputNames
string[]Names of the inputs.
Returns
- TTerminal
The
terminal
.
Type Parameters
TTerminal
Type of the terminal.
Examples
Use this method to simplify adding digital input terminals to the master.
var term1 = master.AddDigitalInputsTerminal(new EL1809(), "10K11", "InBasePosition", "ControlIsOn");
This is equivalent to:
var term1 = new EL1809();
term1.Name = "10K11";
term1.Inputs[0] = "InBasePosition";
term1.Inputs[1] = "ControlIsOn";
master.Add(term1);
Exceptions
- ArgumentNullException
Thrown when
master
,terminal
orinputNames
is null.- ArgumentException
Thrown when the length of
inputNames
is greater than count of Inputs.
AddDigitalOutputsTerminal<TTerminal>(IIOMaster, TTerminal, string, params string[])
Adds a terminal to the master and sets its name and the names of the outputs.
public static TTerminal AddDigitalOutputsTerminal<TTerminal>(this IIOMaster master, TTerminal terminal, string name, params string[] outputNames) where TTerminal : IDigitalOutputsTerminal, ITerminal
Parameters
master
IIOMasterMaster to add the
terminal
.terminal
TTerminalTerminal to add.
name
stringName of the terminal.
outputNames
string[]Names of the outputs.
Returns
- TTerminal
The
terminal
.
Type Parameters
TTerminal
Type of the terminal.
Exceptions
- ArgumentNullException
Thrown when
master
,terminal
oroutputNames
is null.- ArgumentException
Thrown when the length of
outputNames
is greater than count of Outputs.
AddTerminal<TTerminal>(IIOMaster, TTerminal, string)
Adds a terminal to the master and sets its name.
public static TTerminal AddTerminal<TTerminal>(this IIOMaster master, TTerminal terminal, string name) where TTerminal : ITerminal
Parameters
master
IIOMasterMaster to add the
terminal
.terminal
TTerminalName to add.
name
stringName of the terminal.
Returns
- TTerminal
The
terminal
.
Type Parameters
TTerminal
Type of the terminal.
Examples
Use this method to simplify adding terminals to the master.
var term1 = master.AddTerminal(new EL1809(), "10K11");
This is equivalent to:
var term1 = new EL1809();
term1.Name = "10K11";
master.Add(term1);
Exceptions
- ArgumentNullException
Thrown when
master
orterminal
is null.