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
masterIIOMasterMaster to add the
terminal.terminalTTerminalTerminal to add.
namestringName of the terminal.
inputNamesstring[]Names of the inputs.
Returns
- TTerminal
The
terminal.
Type Parameters
TTerminalType 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,terminalorinputNamesis null.- ArgumentException
Thrown when the length of
inputNamesis 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
masterIIOMasterMaster to add the
terminal.terminalTTerminalTerminal to add.
namestringName of the terminal.
outputNamesstring[]Names of the outputs.
Returns
- TTerminal
The
terminal.
Type Parameters
TTerminalType of the terminal.
Exceptions
- ArgumentNullException
Thrown when
master,terminaloroutputNamesis null.- ArgumentException
Thrown when the length of
outputNamesis 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
masterIIOMasterMaster to add the
terminal.terminalTTerminalName to add.
namestringName of the terminal.
Returns
- TTerminal
The
terminal.
Type Parameters
TTerminalType 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
masterorterminalis null.