using System.Collections.Generic;
namespace Chernobyl.Values
{
///
/// A basic implementation of an intended to make
/// the creation of easier. This type is just like
/// except the value is held, i.e.
/// and
/// are implemented.
///
/// The type held by .
public abstract class HeldValue : BasicValue
{
///
/// Initializes a new instance of the class.
///
protected HeldValue()
: this(default(T))
{ }
///
/// Initializes a new instance of the class.
///
/// The value held by this instance.
protected HeldValue(T value)
: this(value, EqualityComparer.Default)
{}
///
/// Initializes a new instance of the class.
///
/// The value held by this instance.
/// The instance used to compare new and previous
/// values of to determine if
/// should be raised.
protected HeldValue(T value, IEqualityComparer comparer)
: base(comparer)
{
_value = value;
}
///
/// The backing property or implementation to
/// . This property should just set and
/// get the value. The property handles
/// setting of and
/// and the raising of
/// .
///
protected override T BackingValue
{
get { return _value; }
set { _value = value; }
}
///
/// The previous value of .
///
protected override T PreviousValue { get; set; }
///
/// The backing field to .
///
T _value;
}
}