Click or drag to resize

TrackableT Class

Represents the change history for a property.
Inheritance Hierarchy
SystemObject
  GSFTrackableT

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public class Trackable<T> : ITrackable, IChangeTracking
View Source

Type Parameters

T

The TrackableT type exposes the following members.

Constructors
 NameDescription
Public methodTrackableT(String, Boolean) Creates a new instance of the TrackableT class.
Public methodTrackableT(String, T, Boolean) Creates a new instance of the TrackableT class.
Top
Properties
 NameDescription
Public propertyChangeList Gets the list of changes to the property's value, starting from its original value and up to the current value.
Public propertyCurrentValue Gets or sets the current value after all changes have been applied to the property.
Public propertyIsChanged Gets a value to indicate whether the property's value has been changed since the last time the current value was committed.
Public propertyOriginalValue Gets the original value before the first change was made to the property.
Public propertyPropertyName Gets the name of the property being tracked.
Top
Methods
 NameDescription
Public methodAcceptChanges Erases all history in the change list and commits the current value as the new original value.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodReset Erases all history in the change list and sets the original value back to its initial value.
Public methodRevert Erases all history in the change list and reverts to the original value before the changes were made.
Public methodSetCurrentValue Sets the current value of the property.
Public methodToString Returns a string that represents the current value.
(Overrides ObjectToString)
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

This class is primarily designed to track changes to the property of an object, as in the following example.

C#
public class MyClass
{
    private Trackable<string> m_trackableText = new Trackable<string>(nameof(Text), true);

    public string Text
    {
        get
        {
            return m_trackableText.CurrentValue;
        }
        set
        {
            m_trackableText.CurrentValue = value;
        }
    }
}
See Also

Reference

GSF Namespace