Table of Contents

Class LogixData

Namespace
L5Sharp
Assembly
L5Sharp.dll

A specialized static factory for deserializing LogixType objects from XElement.

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

LogixType

Methods

Deserialize(XElement)

Deserializes an XElement into a LogixType.

public static LogixType Deserialize(XElement element)

Parameters

element XElement

The element to deserialize.

Returns

LogixType

A LogixType representing the data value, structure, or array or the provided element.

Exceptions

ArgumentNullException

element is null.

NotSupportedException

element has 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

dataType string

The data type name to check.

Returns

bool

true if 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

TStructure

The type of the logix type.

Exceptions

ArgumentException

TStructure is abstract -or- does not have a public constructor accepting a single XElement object.

InvalidOperationException

TStructure is 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

assembly Assembly

The assembly to scan.

Remarks

This is to assist with easily registering types within a specific assembly.

Exceptions

InvalidOperationException

A type is already registered.