Class StructureType
A LogixType that represents a structure containing members of different types.
public abstract class StructureType : LogixType, ILogixSerializable
  - Inheritance
 - 
      
      
      StructureType
 
- Implements
 
- Derived
 
- Inherited Members
 
Remarks
This type is a building block for all Predefined data types. Inherit from this class to create custom
user defined data types that can be used to create in memory representation of the tags for those types.
Inherit from ComplexType if you want the ability to mutate the member structure after instantiation.
Constructors
StructureType(string)
Creates a new StructureType instance.
protected StructureType(string name)
  Parameters
namestringThe name of the type.
Exceptions
- ArgumentException
 nameis null or empty.
StructureType(string, IEnumerable<LogixMember>)
Creates a new StructureType with the provided name and collection of LogixMember objects.
protected StructureType(string name, IEnumerable<LogixMember> members)
  Parameters
namestringThe name of the structure type.
membersIEnumerable<LogixMember>The members of the structure type.
Exceptions
- ArgumentException
 nameis null or empty.- ArgumentNullException
 membersis null.
StructureType(XElement)
Creates a new StructureType initialized from the provided XElement data.
protected StructureType(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.
Properties
Class
The class (atomic, predefined, user-defined) that the type belongs to.
public override DataTypeClass Class { get; }
  Property Value
- DataTypeClass
 A DataTypeClass option representing the class type.
Family
The family (string or none) of the type.
public override DataTypeFamily Family { get; }
  Property Value
- DataTypeFamily
 A DataTypeFamily option representing the family value.
Members
The collection of LogixMember objects that make up the structure of the type.
public override IEnumerable<LogixMember> Members { get; }
  Property Value
- IEnumerable<LogixMember>
 A IEnumerable<T> containing LogixMember objects.
Remarks
All logix types, with the exception of a BOOL and REAL/LREAL, have what can be considered
members. Every derived type must implement this property for which it returns a collection of members, forming
the type/member hierarchy of the logix type.
Name
The name of the logix type.
public override string Name { get; }
  Property Value
Methods
AddMember(LogixMember)
Adds the provided member to the structure type.
protected void AddMember(LogixMember member)
  Parameters
memberLogixMemberThe member to add.
Exceptions
- ArgumentNullException
 memberis null.
AddMembers(ICollection<LogixMember>)
Adds the provided collection of members to the structure type.
protected void AddMembers(ICollection<LogixMember> members)
  Parameters
membersICollection<LogixMember>The collection of members to add.
Exceptions
- ArgumentNullException
 membersis null or any member inmembersis null.
ClearMembers()
Clears all members from the structure type.
protected void ClearMembers()
  GetMember<TLogixType>(string?)
Gets the logix type for the specified member.
protected TLogixType GetMember<TLogixType>(string? name = null) where TLogixType : LogixType
  Parameters
namestringThe member name to find.
Returns
- TLogixType
 A LogixType representing the data of the specified member.
Type Parameters
TLogixTypeThe logix type to return.
Remarks
This method is for users implementing custom user defined or predefined types. Use this as the getter for all member's logix types. The user of CallerMemberName allows the member name to be omitted assuming it matches the name of the calling property.
Exceptions
- InvalidOperationException
 A member with the specified name was not found in the member collection.
InsertMember(int, LogixMember)
Inserts the provided member at the specified index of the structure type.
protected void InsertMember(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.
OnMemberDataChanged(object, EventArgs)
Raises the local logix type DataChanged event, allowing nested member data change event to bubble up the
to the root member.
protected virtual void OnMemberDataChanged(object sender, EventArgs e)
  Parameters
senderobjectThe object that initiated the data change event.
eEventArgsThe event arguments of the data changed event.
RemoveMember(int)
Removes a member at the specified index from the structure type.
protected void RemoveMember(int index)
  Parameters
indexintThe zero-based index of the member to remove.
RemoveMember(string)
Removes a member with the specified name from the structure type.
protected void RemoveMember(string name)
  Parameters
namestringThe name of the member to remove.
ReplaceMember(int, LogixMember)
Replaces a member at the specified index with the provided member instance.
protected void ReplaceMember(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.
ReplaceMember(string, LogixMember)
Replaces a member having the specified name with the provided member instance.
protected void ReplaceMember(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.
ReplaceMember(string, LogixType)
Replaces a member having the specified name with a new member instance of the same name and provided LogixType.
protected void ReplaceMember(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.
Serialize()
Returns a XElement representing the serialized L5X data for a given object.
public override XElement Serialize()
  Returns
SetMember<TLogixType>(TLogixType, string?)
Adds or updates the specified member's logix type with the provided value.
protected void SetMember<TLogixType>(TLogixType value, string? name = null) where TLogixType : LogixType
  Parameters
valueTLogixTypeThe logix type value to set.
namestringThe name of the member to set.
Type Parameters
TLogixTypeThe logix type parameter of the member.
Remarks
This method is for users implementing custom user defined or predefined types. Use this as the setter for all members of the type.
Internally this will update the underlying member collection. If the member already exists, the data type value will be set to the provided value, otherwise a new member will be added at the end of the member collection. This allows the user to initialize member properties in a default constructor in the derived class. Note that the order in which members exist in the underlying collection matters when importing logix type tag data.
Exceptions
- ArgumentNullException
 nameorvalueis null.