Class LogixData
- Namespace
- L5Sharp
- Assembly
- L5Sharp.dll
public static class LogixData
- Inheritance
-
LogixData
- Inherited Members
Remarks
This class is built to specifically find and create concrete instances of atomic, predefined, and custom user defined logix types at runtime. This allows the user to cast a given logix type down to the most specific type as it is deserialized from the L5X tag data structure.
Properties
Null
Returns the singleton null LogixType object.
public static LogixType Null { get; }
Property Value
Methods
Deserialize(XElement)
public static LogixType Deserialize(XElement element)
Parameters
elementXElementThe element to deserialize.
Returns
Exceptions
- ArgumentNullException
elementis null.- NotSupportedException
elementhas a name that is not supported for deserialization.
IsRegistered(string)
Determines if a type with the specified type name is registered for deserialization.
public static bool IsRegistered(string dataType)
Parameters
dataTypestringThe data type name to check.
Returns
- bool
trueif the type is registered; otherwise,false.
Register<TStructure>()
Register a custom StructureType so that it may be instantiated during deserialization of a L5X. The type must implement a constructor accepting a single XElement argument.
public static void Register<TStructure>() where TStructure : StructureType
Type Parameters
TStructureThe type of the logix type.
Exceptions
- ArgumentException
TStructureis abstract -or- does not have a public constructor accepting a single XElement object.- InvalidOperationException
TStructureis already registered.
Scan(Assembly)
Scans the provided assembly using reflection for public non-abstract types inheriting StructureType that have the required deserialization constructor and registers the type so that it may be instantiated during deserialization of a L5X.
public static void Scan(Assembly assembly)
Parameters
assemblyAssemblyThe assembly to scan.
Remarks
This is to assist with easily registering types within a specific assembly.
Exceptions
- InvalidOperationException
A type is already registered.