Class ComplexType
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
namestringThe name of the logix type.
Exceptions
- ArgumentException
nameis 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
namestringThe name of the logix type.
membersIEnumerable<LogixMember>
Exceptions
- ArgumentException
nameis null or empty.- ArgumentNullException
membersis null or any member inmembersis null.
ComplexType(XElement)
Creates a new StructureType initialized from the provided XElement data.
public ComplexType(XElement element)
Parameters
elementXElementThe element to parse as the new member object.
Exceptions
- ArgumentNullException
elementis null.- InvalidOperationException
elementdoes 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
memberLogixMemberThe LogixMember to add.
Exceptions
- ArgumentNullException
memberis null.
AddRange(ICollection<LogixMember>)
Adds the provided member collection to the end of the type member collection.
public void AddRange(ICollection<LogixMember> members)
Parameters
membersICollection<LogixMember>The collection of LogixMember to add.
Exceptions
- ArgumentNullException
membersor any object inmembersis 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
indexintThe zero-based index at which item should be inserted.
memberLogixMemberThe member to insert.
Exceptions
- ArgumentNullException
memberis 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
indexintThe 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
namestringThe 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
indexintThe zer-based index at which to replace the member.
memberLogixMemberThe member to replace the current member with.
Exceptions
- ArgumentNullException
memberis null.
Replace(string, LogixMember)
Replaces a member having the specified name with the provided member instance.
public void Replace(string name, LogixMember member)
Parameters
namestringThe name of the member to replace.
memberLogixMemberThe member to replace the current member with.
Exceptions
- ArgumentNullException
memberis null.- ArgumentException
namedoes 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
namestringThe name of the member to replace.
typeLogixTypeThe LogixType data to update the specified member with.
Exceptions
- ArgumentNullException
typeis null.- ArgumentException
namedoes not exists in the structure type.