Table of Contents

Class ComplexType

Namespace
L5Sharp.Types
Assembly
L5Sharp.dll

A mutable StructureType allowing the user to further extend or transform the structure of a complex logix type after instantiation of the object.

public class ComplexType : StructureType, ILogixSerializable
Inheritance
ComplexType
Implements
Inherited Members

Remarks

This type simply exposes methods for modifying the underlying members collection of a structure type. Users can inherit from this type if they wish to mutate user defined types after instantiation. All structure type elements in the L5X will be deserialized as a complex type unless a specific type is found for them (e.g., TIMER). Predefined types will inherit structure type as they should not be mutated.

Constructors

ComplexType()

Creates a new empty ComplexType with the name 'ComplexType' indicating this represents some generic or non-descriptive type with members configured by the user.

public ComplexType()

ComplexType(string)

Creates a new ComplexType with the provided name.

public ComplexType(string name)

Parameters

name string

The name of the logix type.

Exceptions

ArgumentException

name is null or empty.

ComplexType(string, IEnumerable<LogixMember>)

Creates a new ComplexType with the provided name and member collection.

public ComplexType(string name, IEnumerable<LogixMember> members)

Parameters

name string

The name of the logix type.

members IEnumerable<LogixMember>

Exceptions

ArgumentException

name is null or empty.

ArgumentNullException

members is null or any member in members is null.

ComplexType(XElement)

Creates a new StructureType initialized from the provided XElement data.

public ComplexType(XElement element)

Parameters

element XElement

The element to parse as the new member object.

Exceptions

ArgumentNullException

element is null.

InvalidOperationException

element does not have required attributes or child elements.

Methods

Add(LogixMember)

Adds the provided member to the end of the type member collection.

public void Add(LogixMember member)

Parameters

member LogixMember

The LogixMember to add.

Exceptions

ArgumentNullException

member is null.

AddRange(ICollection<LogixMember>)

Adds the provided member collection to the end of the type member collection.

public void AddRange(ICollection<LogixMember> members)

Parameters

members ICollection<LogixMember>

The collection of LogixMember to add.

Exceptions

ArgumentNullException

members or any object in members is null.

Clear()

Removes all members from the current type.

public void Clear()

Insert(int, LogixMember)

Inserts the provided member at the specified index of the type member collection.

public void Insert(int index, LogixMember member)

Parameters

index int

The zero-based index at which item should be inserted.

member LogixMember

The member to insert.

Exceptions

ArgumentNullException

member is null.

ArgumentOutOfRangeException

index is less than 0. -or- index is greater than the length of the member collection.

Remove(int)

Removes a member at the specified index from the type member collection.

public void Remove(int index)

Parameters

index int

The zero-based index of the member to remove.

Remove(string)

Removes a member with the specified name from the type member collection.

public void Remove(string name)

Parameters

name string

The name of the member to remove.

Replace(int, LogixMember)

Replaces a member at the specified index with the provided member instance.

public void Replace(int index, LogixMember member)

Parameters

index int

The zer-based index at which to replace the member.

member LogixMember

The member to replace the current member with.

Exceptions

ArgumentNullException

member is null.

Replace(string, LogixMember)

Replaces a member having the specified name with the provided member instance.

public void Replace(string name, LogixMember member)

Parameters

name string

The name of the member to replace.

member LogixMember

The member to replace the current member with.

Exceptions

ArgumentNullException

member is null.

ArgumentException

name does not exists in the structure type.

Replace(string, LogixType)

Replaces a member having the specified name with a new member instance of the same name and provided LogixType.

public void Replace(string name, LogixType type)

Parameters

name string

The name of the member to replace.

type LogixType

The LogixType data to update the specified member with.

Exceptions

ArgumentNullException

type is null.

ArgumentException

name does not exists in the structure type.