Class UDINT
Represents a UDINT Logix atomic data type, or a type analogous to a uint.
public sealed class UDINT : AtomicType, ILogixSerializable, IComparable, IConvertible
- Inheritance
-
UDINT
- Implements
- Inherited Members
Constructors
UDINT()
Creates a new default UDINT type.
public UDINT()
UDINT(Radix)
Creates a new UDINT value with the provided radix format.
public UDINT(Radix radix)
Parameters
Exceptions
- ArgumentNullException
radixis null.- ArgumentException
radixis not supported by the atomic type.
UDINT(uint)
Creates a new UDINT with the provided value.
public UDINT(uint value)
Parameters
valueuintThe value to initialize the type with.
UDINT(uint, Radix)
Creates a new UDINT with the provided value and radix format.
public UDINT(uint value, Radix radix)
Parameters
valueuintThe value to initialize the type with.
radixRadixThe optional radix format of the value.
Exceptions
- ArgumentNullException
radixis null.- ArgumentException
radixis not supported by the atomic type.
Properties
this[int]
Gets bit member's data type value at the specified bit index.
public BOOL this[int bit] { get; }
Parameters
bitintThe zero based bit index of the value to get.
Property Value
Exceptions
- ArgumentOutOfRangeException
bitis out of range of the atomic type bit length.
Name
The name of the logix type.
public override string Name { get; }
Property Value
Radix
The radix format for the AtomicType.
public override Radix Radix { get; }
Property Value
Methods
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
ValueMeaning
Less than zero
This instance precedes
objin the sort order.Zero
This instance occurs in the same position in the sort order as
obj.Greater than zero
This instance follows
objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetBytes()
Returns the AtomicType value as an array of byte values.
public override byte[] GetBytes()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
OnMemberDataChanged(object, EventArgs)
Executes the logic to update the atomic value and forward the data changed event up the type/member hierarchy.
protected override void OnMemberDataChanged(object sender, EventArgs e)
Parameters
Remarks
Atomic members (bits) represent the value of the type. When the member data changed event is triggered, we want to intercept that on the parent atomic type in order to change/update the reflected value. We can do that by getting the changed member (sender) name (bit number) and value (bit value) and setting to get the updated value. However, since atomic types ar immutable, we have to send the changed value up the chain to the parent member (Tag, DataValue, DataValueMember) so that it can replace it's data type with the new atomic value. This is captured in LogixMember.
Parse(string)
Parses the provided string value to a new UDINT.
public static UDINT Parse(string value)
Parameters
valuestringThe string value to parse.
Returns
Exceptions
- FormatException
The Radix format can not be inferred from
value.
Operators
implicit operator string(UDINT)
public static implicit operator string(UDINT value)
Parameters
valueUDINTThe value to convert.
Returns
implicit operator uint(UDINT)
public static implicit operator uint(UDINT atomic)
Parameters
atomicUDINTThe value to convert.
Returns
implicit operator UDINT(string)
public static implicit operator UDINT(string value)
Parameters
valuestringThe value to convert.
Returns
implicit operator UDINT(uint)
public static implicit operator UDINT(uint value)
Parameters
valueuintThe value to convert.