Class LogixType
- Namespace
- L5Sharp
- Assembly
- L5Sharp.dll
The base class for all logix type classes, which represent the value or data structure of a logix tag component.
public abstract class LogixType : ILogixSerializable
- Inheritance
-
LogixType
- Implements
- Derived
- Inherited Members
Remarks
This class exposes the common data type properties, such as Name, Family, Class, and Members. This class also provides common implicit conversions between .NET base types and LogixType classes so that the tag values may be set in a concise way.
Properties
Class
The class (atomic, predefined, user-defined) that the type belongs to.
public abstract DataTypeClass Class { get; }
Property Value
- DataTypeClass
A DataTypeClass option representing the class type.
- See Also
Family
The family (string or none) of the type.
public abstract DataTypeFamily Family { get; }
Property Value
- DataTypeFamily
A DataTypeFamily option representing the family value.
- See Also
Members
The collection of LogixMember objects that make up the structure of the type.
public abstract 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.
- See Also
Name
The name of the logix type.
public abstract string Name { get; }
Property Value
- See Also
Methods
As<TLogixType>()
Casts the LogixType to the type of the generic parameter.
public TLogixType As<TLogixType>() where TLogixType : LogixType
Returns
- TLogixType
The logix type object casted as the specified generic type parameter.
Type Parameters
TLogixType
The logix type to cast to.
Exceptions
- InvalidCastException
The object can not be casted to the specified type.
- See Also
Clone()
Returns a new deep cloned instance of the current type.
public LogixType Clone()
Returns
- LogixType
A new instance of the specified logix type with the same property values.
Remarks
This method will simply deserialize a new instance using the current underlying element data.
Exceptions
- InvalidOperationException
The object being cloned does not have a constructor accepting a single XElement argument.
- See Also
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
- See Also
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
- See Also
Member(string)
Gets a LogixMember with the specified name if it exists for the LogixType;
Otherwise, returns null
.
public LogixMember? Member(string name)
Parameters
name
stringThe name of the member to get.
Returns
- LogixMember
A LogixMember with the specified name if found; Otherwise,
null
.
Remarks
This performs a case insensitive comparison for the member name.
- See Also
RaiseDataChanged(object)
Raising the DataChanged event for the type with the provided object sender.
protected void RaiseDataChanged(object sender)
Parameters
sender
objectThe objet initiating the data changed event. This could be this object, or a descendent member or type in the data hierarchy.
- See Also
Serialize()
Returns a XElement representing the serialized L5X data for a given object.
public abstract XElement Serialize()
Returns
- See Also
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
- See Also
Events
DataChanged
An event that triggers when the LogixType members collection changes.
public event EventHandler? DataChanged
Event Type
Remarks
This event is allowing us to detect when the value of a immediate or nested logix type changes. This is important for tag so that it can know when to update the underlying XML data structure represented by the in-memory data structure.
- See Also
Operators
operator ==(LogixType, LogixType)
Determines whether the LogixType values are equal.
public static bool operator ==(LogixType left, LogixType right)
Parameters
Returns
- bool
true
if the objects are equal, otherwise,false
.
- See Also
operator >(LogixType, LogixType)
Compares two objects and determines if a is greater than b.
public static bool operator >(LogixType a, LogixType b)
Parameters
Returns
- bool
true
ifa
is greater thanb
, otherwise,false
.
- See Also
operator >=(LogixType, LogixType)
Compares two objects and determines if a is greater or equal to than b.
public static bool operator >=(LogixType a, LogixType b)
Parameters
Returns
- bool
true
ifa
is greater than or equal tob
, otherwise,false
.
- See Also
implicit operator LogixType(LogixType[,,])
public static implicit operator LogixType(LogixType[,,] value)
Parameters
value
LogixType[,,]The value to convert.
Returns
- See Also
implicit operator LogixType(LogixType[,])
public static implicit operator LogixType(LogixType[,] value)
Parameters
value
LogixType[,]The value to convert.
Returns
- See Also
implicit operator LogixType(LogixType[])
public static implicit operator LogixType(LogixType[] value)
Parameters
value
LogixType[]The value to convert.
Returns
- See Also
implicit operator LogixType(bool)
public static implicit operator LogixType(bool value)
Parameters
value
boolThe value to convert.
Returns
- See Also
implicit operator LogixType(byte)
public static implicit operator LogixType(byte value)
Parameters
value
byteThe value to convert.
Returns
- See Also
implicit operator LogixType(Dictionary<string, LogixType>)
Converts the provided Dictionary<TKey, TValue> to a LogixType.
public static implicit operator LogixType(Dictionary<string, LogixType> value)
Parameters
value
Dictionary<string, LogixType>The value to convert.
Returns
- See Also
implicit operator LogixType(double)
public static implicit operator LogixType(double value)
Parameters
value
doubleThe value to convert.
Returns
- See Also
implicit operator LogixType(short)
public static implicit operator LogixType(short value)
Parameters
value
shortThe value to convert.
Returns
- See Also
implicit operator LogixType(int)
public static implicit operator LogixType(int value)
Parameters
value
intThe value to convert.
Returns
- See Also
implicit operator LogixType(long)
public static implicit operator LogixType(long value)
Parameters
value
longThe value to convert.
Returns
- See Also
implicit operator LogixType(sbyte)
public static implicit operator LogixType(sbyte value)
Parameters
value
sbyteThe value to convert.
Returns
- See Also
implicit operator LogixType(float)
public static implicit operator LogixType(float value)
Parameters
value
floatThe value to convert.
Returns
- See Also
implicit operator LogixType(string)
public static implicit operator LogixType(string value)
Parameters
value
stringThe value to convert.
Returns
- See Also
implicit operator LogixType(ushort)
public static implicit operator LogixType(ushort value)
Parameters
value
ushortThe value to convert.
Returns
- See Also
implicit operator LogixType(uint)
public static implicit operator LogixType(uint value)
Parameters
value
uintThe value to convert.
Returns
- See Also
implicit operator LogixType(ulong)
public static implicit operator LogixType(ulong value)
Parameters
value
ulongThe value to convert.
Returns
- See Also
operator !=(LogixType, LogixType)
Determines whether the LogixType values are not equal.
public static bool operator !=(LogixType left, LogixType right)
Parameters
Returns
- bool
true
if the objects are not equal, otherwise,false
.
- See Also
operator <(LogixType, LogixType)
Compares two objects and determines if a is less than b.
public static bool operator <(LogixType a, LogixType b)
Parameters
Returns
- bool
true
ifa
is less thanb
, otherwise,false
.
- See Also
operator <=(LogixType, LogixType)
Compares two objects and determines if a is less than or equal to b.
public static bool operator <=(LogixType a, LogixType b)
Parameters
Returns
- bool
true
ifa
is less than or equal tob
, otherwise,false
.
- See Also